Update EF

This commit is contained in:
2021-12-26 17:06:47 +04:00
parent 5f93d60277
commit 756af71f15
3 changed files with 14 additions and 8 deletions
+3 -2
View File
@@ -32,9 +32,10 @@ namespace Kruzya.TelegramBot.Core
foreach (var module in _core.Modules) services.AddSingleton(module.GetType(), module);
// Add database context to DI.
var connectionString = _core.Configuration.GetConnectionString("DefaultConnection");
services.AddDbContext<CoreContext>(ctx =>
ctx.UseMySql(_core.Configuration.GetConnectionString("DefaultConnection")));
ctx.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
// Trigger module handlers.
_core.Modules.ConfigureServices(services);
}