Files
components/LiteCharms.Features/Shop/Postgres/ShopDbContextFactory.cs
T
Khwezi Mngoma 7d5e9a18d8
continuous-integration/drone/pr Build is failing
Added MidrandShop feature and spl;it extensions and healthchecks
2026-05-23 11:48:47 +02:00

22 lines
756 B
C#

using static LiteCharms.Features.Extensions.Postgres;
namespace LiteCharms.Features.Shop.Postgres;
public class ShopDbContextFactory : IDesignTimeDbContextFactory<ShopDbContext>
{
public ShopDbContext CreateDbContext(string[] args)
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddUserSecrets(typeof(ShopDbContext).Assembly)
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables()
.Build();
var optionsBuilder = new DbContextOptionsBuilder<ShopDbContext>();
optionsBuilder.UseNpgsql(configuration.GetConnectionString(ShopDbConfigName));
return new ShopDbContext(optionsBuilder.Options);
}
}