Fix Unhandled DBErrors in ComponentsWebAssembly and Spa templates (#25466)
* Add workaround for EF issue dotnet/efcore#22341
This commit is contained in:
parent
748686fa91
commit
222dd67175
|
|
@ -38,7 +38,8 @@ namespace Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
|
|||
{
|
||||
// Look for DbContext classes registered in the service provider
|
||||
var registeredContexts = errorContext.HttpContext.RequestServices.GetServices<DbContextOptions>()
|
||||
.Select(o => o.ContextType);
|
||||
.Select(o => o.ContextType)
|
||||
.Distinct(); // Workaround for https://github.com/dotnet/efcore/issues/22341
|
||||
|
||||
if (registeredContexts.Any())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ namespace ComponentsWebAssembly_CSharp.Server
|
|||
#else
|
||||
options.UseSqlite(
|
||||
Configuration.GetConnectionString("DefaultConnection")));
|
||||
#endif
|
||||
|
||||
services.AddDatabaseDeveloperPageExceptionFilter();
|
||||
#endif
|
||||
|
||||
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<ApplicationDbContext>();
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ namespace Company.WebApplication1
|
|||
#else
|
||||
options.UseSqlite(
|
||||
Configuration.GetConnectionString("DefaultConnection")));
|
||||
#endif
|
||||
|
||||
services.AddDatabaseDeveloperPageExceptionFilter();
|
||||
#endif
|
||||
|
||||
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<ApplicationDbContext>();
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ namespace Company.WebApplication1
|
|||
#else
|
||||
options.UseSqlite(
|
||||
Configuration.GetConnectionString("DefaultConnection")));
|
||||
#endif
|
||||
|
||||
services.AddDatabaseDeveloperPageExceptionFilter();
|
||||
#endif
|
||||
|
||||
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<ApplicationDbContext>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue