Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created October 16, 2018 00:26
Show Gist options
  • Save dcomartin/89ae0e5fdb24b4fbdefbdea3fc515f64 to your computer and use it in GitHub Desktop.
Save dcomartin/89ae0e5fdb24b4fbdefbdea3fc515f64 to your computer and use it in GitHub Desktop.
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