26 lines
756 B
C#
26 lines
756 B
C#
using AdminService.Infrastructure.Persistence;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace AdminService.Infrastructure;
|
|
|
|
public static class DependencyInjection
|
|
{
|
|
public static IServiceCollection AddInfrastructure(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
var connectionString =
|
|
configuration.GetConnectionString("DefaultConnection");
|
|
|
|
services.AddDbContext<AppDbContext>(options =>
|
|
options.UseNpgsql(
|
|
connectionString,
|
|
x => x.MigrationsHistoryTable(
|
|
"__EFMigrationsHistory",
|
|
"admin")));
|
|
|
|
return services;
|
|
}
|
|
} |