Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Created December 21, 2018 21:15
Embed
What would you like to do?
public class SampleDbContextFactory : IDesignTimeDbContextFactory<SampleDbContext>
{
public SampleDbContext CreateDbContext(string[] args)
{
// Get DbContext from DI system
var resolver = new DependencyResolver
{
CurrentDirectory = Path.Combine(Directory.GetCurrentDirectory(), "../NetCoreLambda")
};
return resolver.ServiceProvider.GetService(typeof(SampleDbContext)) as SampleDbContext;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment