danstore / ECommerce.Model /Data /DesignTimeDbContextFactory.cs
Danishathugging's picture
Sync from GitHub via hub-sync
6db0915 verified
Raw
History Blame Contribute Delete
508 Bytes
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace ECommerce.Model.Data;
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
{
public AppDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>();
optionsBuilder.UseNpgsql("Host=localhost;Database=ecommerce;Username=postgres;Password=postgres");
return new AppDbContext(optionsBuilder.Options);
}
}