Add infrastructure layer with persistence and services
- EF Core DbContext and entity configurations - Design-time factory for migrations - Initial and soft-delete migrations - Service implementations: Account, AccountYear, Entry, BalanceQuery, FileSave, PdfStatement - Dependency injection registration
This commit is contained in:
24
src/Duempelkas.Infrastructure/DependencyInjection.cs
Normal file
24
src/Duempelkas.Infrastructure/DependencyInjection.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Duempelkas.App.Services;
|
||||
using Duempelkas.Infrastructure.Persistence;
|
||||
using Duempelkas.Infrastructure.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Duempelkas.Infrastructure;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static IServiceCollection AddInfrastructure(this IServiceCollection services, string connectionString)
|
||||
{
|
||||
services.AddDbContext<FinanceDbContext>(options =>
|
||||
options.UseSqlite(connectionString));
|
||||
|
||||
services.AddScoped<IAccountService, AccountService>();
|
||||
services.AddScoped<IEntryService, EntryService>();
|
||||
services.AddScoped<IBalanceQueryService, BalanceQueryService>();
|
||||
services.AddScoped<IPdfStatementService, PdfStatementService>();
|
||||
services.AddScoped<IFileSaveService, FileSaveService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user