Switch to MapControllerRoute instead of UseMvc

pull/1810/head
Halil İbrahim Kalkan 5 years ago
parent f24a32b201
commit a52ba7787d

@ -17,19 +17,15 @@ namespace Microsoft.AspNetCore.Builder
/// <returns>A reference to this instance after the operation has completed.</returns>
public static IApplicationBuilder UseMvcWithDefaultRouteAndArea(
this IApplicationBuilder app,
Action<IRouteBuilder> additionalConfigurationAction = null)
Action<IEndpointRouteBuilder> additionalConfigurationAction = null)
{
return app.UseMvc(routes =>
return app.UseEndpoints(endpoints =>
{
routes.MapRoute(
name: "defaultWithArea",
template: "{area}/{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
endpoints.MapRazorPages();
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
additionalConfigurationAction?.Invoke(routes);
additionalConfigurationAction?.Invoke(endpoints);
});
}
}

@ -77,10 +77,12 @@ namespace Volo.Abp.AspNetCore.Mvc
var app = context.GetApplicationBuilder();
app.UseCorrelationId();
app.UseRouting();
app.UseMiddleware<FakeAuthenticationMiddleware>();
app.UseAuthorization();
app.UseAuditing();
app.UseUnitOfWork();
app.UseMvcWithDefaultRoute();
app.UseMvcWithDefaultRouteAndArea();
}
}
}

@ -66,7 +66,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseMvcWithDefaultRoute();
app.UseMvcWithDefaultRouteAndArea();
}
}
}

Loading…
Cancel
Save