WiP storage for modules

This commit is contained in:
2020-03-08 01:55:50 +04:00
parent 768a0d064f
commit 3fd5042367
11 changed files with 375 additions and 0 deletions
+6
View File
@@ -1,7 +1,9 @@
using BotFramework;
using Kruzya.TelegramBot.Core.Data;
using Kruzya.TelegramBot.Core.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@@ -29,6 +31,10 @@ namespace Kruzya.TelegramBot.Core
services.AddSingleton<Core>(_core);
foreach (var module in _core.Modules) services.AddSingleton(module.GetType(), module);
// Add database context to DI.
services.AddDbContext<CoreContext>(ctx =>
ctx.UseMySql(_core.Configuration.GetConnectionString("DefaultConnection")));
// Trigger module handlers.
_core.Modules.ConfigureServices(services);
}