Last active
March 24, 2017 07:13
-
-
Save jpvelasco/8aa6d718d5d051685afdff324ebf7276 to your computer and use it in GitHub Desktop.
Sample implementation of IDBContextFactory for Entity Framework Core tooling
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 EventDbContextFactory : IDbContextFactory<EventDataContext> | |
{ | |
public EventDataContext Create(DbContextFactoryOptions options) | |
{ | |
var builder = new DbContextOptionsBuilder<EventDataContext>(); | |
builder.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=SampleApiDatabase;Trusted_Connection=True;"); | |
return new EventDataContext(builder.Options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment