Created
April 9, 2018 13:11
-
-
Save jesslilly/5fad464839a41daa5e79aa5e027fb15d to your computer and use it in GitHub Desktop.
Simple IDesignTimeDbContextFactory example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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