Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ProductsDbContextFactory4
public class ProductsDbContextFactory : IDesignTimeDbContextFactory<ProductsDbContext>
{
public ProductsDbContext CreateDbContext(string[] args)
{
// Get DbContext from DI system
var resolver = new DependencyResolver
{
CurrentDirectory = Path.Combine(Directory.GetCurrentDirectory(), "../EfDesignDemo.Web")
};
return resolver.ServiceProvider.GetService(typeof(ProductsDbContext)) as ProductsDbContext;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.