@
R3 Slice 1: EF-Core-Infrastruktur im Core + InitialCore-Migration - Pomelo.EntityFrameworkCore.MySql 8.0.3 + EF Core Design 8.0.11 (Core), NuGet-Allowlist erweitert - Configuration/DatabaseOptions + DatabaseServerVersion (MariaDB 11.8.6 gepinnt) - Persistence/Entities: CorePosition, CoreTrade, CoreBudget, CoreWorkerLog, CoreSetting - Persistence/Ef/CoreDbContext (core_-Tabellen) + Design-Time-Factory (env IBKRTRADER_MYSQL) - DependencyInjection/AddCorePersistence (AddDbContextFactory), in Program verdrahtet (Connection aus appsettings.Local.json) - EF-Migration InitialCore erzeugt (5 core_-Tabellen) - Consumer noch auf Dapper (folgt in Slice 2); Build + 30/30 Tests + smoke-ui gruen Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> @
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using IBKRTrader.Core.Configuration;
|
||||
using IBKRTrader.Core.Persistence.Ef;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace IBKRTrader.Core.DependencyInjection;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Registriert die Core-Persistenzschicht (EF Core / Pomelo / MariaDB) über einen
|
||||
/// DbContextFactory (thread-safe, kurzlebiger Context je Operation).
|
||||
/// </summary>
|
||||
public static IServiceCollection AddCorePersistence(this IServiceCollection services, DatabaseOptions options)
|
||||
{
|
||||
services.AddDbContextFactory<CoreDbContext>(o =>
|
||||
o.UseMySql(options.MySqlConnectionString, DatabaseServerVersion.Value));
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user