mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Update EF
This commit is contained in:
+9
-5
@@ -6,13 +6,17 @@
|
||||
<RootNamespace>Kruzya.TelegramBot.Core</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Core' " />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AleXr64.BotFramework" Version="0.6.3-gea779222d8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="3.1.2" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.13">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="5.0.13" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.13" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
+2
-1
@@ -32,8 +32,9 @@ 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);
|
||||
|
||||
@@ -19,9 +19,10 @@ namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
var connectionString = Configuration.GetConnectionString("RichSiteSummary");
|
||||
services.AddDbContext<RichSiteSummaryContext>(options =>
|
||||
options.UseLazyLoadingProxies()
|
||||
.UseMySql(Configuration.GetConnectionString("RichSiteSummary")));
|
||||
.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
|
||||
|
||||
services.AddTelegramBotParameterParser<Feed, DbResolverParameter<Feed, RichSiteSummaryContext>>()
|
||||
.AddTelegramBotParameterParser<Post, DbResolverParameter<Post, RichSiteSummaryContext>>()
|
||||
|
||||
Reference in New Issue
Block a user