mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
WiP storage for modules
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user