Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple IDesignTimeDbContextFactory example
public class FooDbContextFactory : IDesignTimeDbContextFactory<FooDbContext>
{
public FooDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<FooDbContext>();
optionsBuilder.UseSqlServer("DeaultConnection");
return new FooDbContext(optionsBuilder.Options);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment