From c9026451152951bb15ef1522aceef07f98d16c33 Mon Sep 17 00:00:00 2001 From: John Luo Date: Fri, 4 Sep 2020 15:46:14 -0700 Subject: [PATCH] Add MigrationsEndPoint when DatabaseDeveloperPageExceptionFilter is used (#25554) --- .../samples/ApiAuthSample/Startup.cs | 1 + src/Identity/samples/IdentitySample.DefaultUI/Startup.cs | 1 + src/Identity/samples/IdentitySample.Mvc/Startup.cs | 1 + .../testassets/Identity.DefaultUI.WebSite/NoIdentityStartup.cs | 1 + .../testassets/Identity.DefaultUI.WebSite/StartupBase.cs | 1 + .../StartupWithoutEndpointRouting.cs | 1 + .../MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs | 2 ++ .../MusicStore/ForTesting/Mocks/StartupSocialTesting.cs | 2 ++ src/MusicStore/samples/MusicStore/Startup.cs | 2 ++ src/MusicStore/samples/MusicStore/StartupNtlmAuthentication.cs | 2 ++ src/MusicStore/samples/MusicStore/StartupOpenIdConnect.cs | 2 ++ .../content/BlazorServerWeb-CSharp/Startup.cs | 3 +++ .../content/ComponentsWebAssembly-CSharp/Server/Startup.cs | 3 +++ .../content/RazorPagesWeb-CSharp/Startup.cs | 3 +++ .../Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs | 3 +++ .../Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs | 3 +++ .../Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs | 3 +++ src/Security/samples/Identity.ExternalClaims/Startup.cs | 1 + 18 files changed, 35 insertions(+) diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Startup.cs b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Startup.cs index e734bb51aa..03226a7b77 100644 --- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Startup.cs +++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/Startup.cs @@ -50,6 +50,7 @@ namespace ApiAuthSample if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); } else { diff --git a/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs b/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs index 69a36323bc..d3158994a2 100644 --- a/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs +++ b/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs @@ -60,6 +60,7 @@ namespace IdentitySample.DefaultUI if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); } else { diff --git a/src/Identity/samples/IdentitySample.Mvc/Startup.cs b/src/Identity/samples/IdentitySample.Mvc/Startup.cs index 7415a7059c..8362bf2519 100644 --- a/src/Identity/samples/IdentitySample.Mvc/Startup.cs +++ b/src/Identity/samples/IdentitySample.Mvc/Startup.cs @@ -63,6 +63,7 @@ namespace IdentitySample if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); } else { diff --git a/src/Identity/testassets/Identity.DefaultUI.WebSite/NoIdentityStartup.cs b/src/Identity/testassets/Identity.DefaultUI.WebSite/NoIdentityStartup.cs index 2f7165144d..017f8e7a0d 100644 --- a/src/Identity/testassets/Identity.DefaultUI.WebSite/NoIdentityStartup.cs +++ b/src/Identity/testassets/Identity.DefaultUI.WebSite/NoIdentityStartup.cs @@ -49,6 +49,7 @@ namespace Identity.DefaultUI.WebSite if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); } else { diff --git a/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupBase.cs b/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupBase.cs index 91bb3bab86..ba58d3c504 100644 --- a/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupBase.cs +++ b/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupBase.cs @@ -65,6 +65,7 @@ namespace Identity.DefaultUI.WebSite if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); } else { diff --git a/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupWithoutEndpointRouting.cs b/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupWithoutEndpointRouting.cs index 2056a56278..654f5948b8 100644 --- a/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupWithoutEndpointRouting.cs +++ b/src/Identity/testassets/Identity.DefaultUI.WebSite/StartupWithoutEndpointRouting.cs @@ -34,6 +34,7 @@ namespace Identity.DefaultUI.WebSite if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); } else { diff --git a/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs b/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs index 4eea7e215e..9792b5853c 100644 --- a/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs +++ b/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs @@ -125,6 +125,8 @@ namespace MusicStore // During development use the ErrorPage middleware to display error information in the browser app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); + // Configure Session. app.UseSession(); diff --git a/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs b/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs index e0e281dca6..0b562f9063 100644 --- a/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs +++ b/src/MusicStore/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs @@ -161,6 +161,8 @@ namespace MusicStore // Note: Not recommended for production. app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); + // Configure Session. app.UseSession(); diff --git a/src/MusicStore/samples/MusicStore/Startup.cs b/src/MusicStore/samples/MusicStore/Startup.cs index 60f8d93951..56e9b98057 100644 --- a/src/MusicStore/samples/MusicStore/Startup.cs +++ b/src/MusicStore/samples/MusicStore/Startup.cs @@ -134,6 +134,8 @@ namespace MusicStore // During development use the ErrorPage middleware to display error information in the browser app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); + Configure(app); } diff --git a/src/MusicStore/samples/MusicStore/StartupNtlmAuthentication.cs b/src/MusicStore/samples/MusicStore/StartupNtlmAuthentication.cs index f4e3113323..3ebb9bbc3f 100644 --- a/src/MusicStore/samples/MusicStore/StartupNtlmAuthentication.cs +++ b/src/MusicStore/samples/MusicStore/StartupNtlmAuthentication.cs @@ -117,6 +117,8 @@ namespace MusicStore // Note: Not recommended for production. app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); + app.Use((context, next) => { context.Response.Headers["Arch"] = RuntimeInformation.ProcessArchitecture.ToString(); diff --git a/src/MusicStore/samples/MusicStore/StartupOpenIdConnect.cs b/src/MusicStore/samples/MusicStore/StartupOpenIdConnect.cs index 50403b2933..cbbf1daef5 100644 --- a/src/MusicStore/samples/MusicStore/StartupOpenIdConnect.cs +++ b/src/MusicStore/samples/MusicStore/StartupOpenIdConnect.cs @@ -124,6 +124,8 @@ namespace MusicStore // During development use the ErrorPage middleware to display error information in the browser app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); + // Configure Session. app.UseSession(); diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs index 652c82a570..c3c6fb832c 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Startup.cs @@ -136,6 +136,9 @@ namespace BlazorServerWeb_CSharp if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); +#if (IndividualLocalAuth) + app.UseMigrationsEndPoint(); +#endif } else { diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs index 52df8d06aa..00aef16c80 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs @@ -99,6 +99,9 @@ namespace ComponentsWebAssembly_CSharp.Server if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); +#if (IndividualLocalAuth) + app.UseMigrationsEndPoint(); +#endif app.UseWebAssemblyDebugging(); } else diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Startup.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Startup.cs index 0114d62081..36409d8e26 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Startup.cs @@ -119,6 +119,9 @@ namespace Company.WebApplication1 if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); +#if (IndividualLocalAuth) + app.UseMigrationsEndPoint(); +#endif } else { diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs index 1308fe4cab..f9b4447b64 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs @@ -120,6 +120,9 @@ namespace Company.WebApplication1 if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); +#if (IndividualLocalAuth) + app.UseMigrationsEndPoint(); +#endif } else { diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 73e8a87af1..ed119d2a13 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -72,6 +72,9 @@ namespace Company.WebApplication1 if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); +#if (IndividualLocalAuth) + app.UseMigrationsEndPoint(); +#endif } else { diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs index 378ce7bcee..6e1485ddd7 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs @@ -74,6 +74,9 @@ namespace Company.WebApplication1 if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); +#if (IndividualLocalAuth) + app.UseMigrationsEndPoint(); +#endif } else { diff --git a/src/Security/samples/Identity.ExternalClaims/Startup.cs b/src/Security/samples/Identity.ExternalClaims/Startup.cs index 8ad8188edf..30f63bf4ad 100644 --- a/src/Security/samples/Identity.ExternalClaims/Startup.cs +++ b/src/Security/samples/Identity.ExternalClaims/Startup.cs @@ -74,6 +74,7 @@ namespace Identity.ExternalClaims if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseMigrationsEndPoint(); } else {