I have upgraded my code from ASP.NET Core 2.0 to Core 2.1. I created a new Core 2.1 project and moved my code into the new project. I have provided samples of my startup and
Change the ApplicationDbContext
to:
private static bool _Created = false;
public ApplicationDbContext()
{
if (!_Created)
{
_Created = true;
Database.EnsureCreated();
}
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(@"server = .\SQLSERVER; initial catalog = DBName; Integrated Security = True; MultipleActiveResultSets = True; App = EntityFramework & quot; ");
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}