Created
December 30, 2018 17:00
-
-
Save azaharafernandezguizan/32718d5adb3a2d73fc27b225c89ead10 to your computer and use it in GitHub Desktop.
OnConfiguring Context method from NetCore
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
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
{ | |
if (!optionsBuilder.IsConfigured) | |
{ | |
IConfigurationRoot configuration = new ConfigurationBuilder() | |
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory) | |
.AddJsonFile("appsettings.json") | |
.Build(); | |
optionsBuilder.UseMySql(configuration.GetConnectionString("MicrobiologiaDatabase")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment