28 lines
1015 B
C#
28 lines
1015 B
C#
using LiteCharms.Features.MidrandShop.Postgres;
|
|
using LiteCharms.Features.Shop.Postgres;
|
|
|
|
namespace LiteCharms.Features.Extensions;
|
|
|
|
public static class Postgres
|
|
{
|
|
public const string MidrandShopDbConfigName = "PostgresMidrandShop";
|
|
public const string ShopDbConfigName = "PostgresShop";
|
|
public const string SchedulerDbConfigName = "PostgresScheduler";
|
|
|
|
public static IServiceCollection AddShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
services.AddPooledDbContextFactory<ShopDbContext>(options =>
|
|
options.UseNpgsql(configuration.GetConnectionString(ShopDbConfigName)));
|
|
|
|
return services;
|
|
}
|
|
|
|
public static IServiceCollection AddMidrandShopDatabase(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
services.AddPooledDbContextFactory<MidrandShopDbContext>(options =>
|
|
options.UseNpgsql(configuration.GetConnectionString(MidrandShopDbConfigName)));
|
|
|
|
return services;
|
|
}
|
|
}
|