Created
October 16, 2018 00:26
-
-
Save dcomartin/89ae0e5fdb24b4fbdefbdea3fc515f64 to your computer and use it in GitHub Desktop.
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 MyDbContext(string connectionString) | |
{ | |
_connectionString = connectionString; | |
} | |
public MyDbContext(DbContextOptions<MyDbContext> options) : base(options) { } | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
{ | |
if (optionsBuilder.IsConfigured == false) | |
{ | |
optionsBuilder | |
.UseMySql(_connectionString) | |
.ConfigureWarnings(warnings => warnings.Throw(RelationalEventId.QueryClientEvaluationWarning)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment