Added UseMvcWithDefaultRoute extension to BuilderExtensions
Added `UseMvcWithDefaultRoute` extension method to `BuilderExtensions`, which adds Mvc to the request pipeline with a default route to the `Index` action on the `HomeController`. #1885
This commit is contained in:
parent
3ea7daabfe
commit
53f3a91f01
|
|
@ -29,6 +29,22 @@ namespace Microsoft.AspNet.Builder
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds Mvc to the <see cref="IApplicationBuilder"/> request execution pipeline
|
||||||
|
/// with a default route.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="app">The <see cref="IApplicationBuilder"/>.</param>
|
||||||
|
/// <returns>The <paramref name="app"/>.</returns>
|
||||||
|
public static IApplicationBuilder UseMvcWithDefaultRoute([NotNull] this IApplicationBuilder app)
|
||||||
|
{
|
||||||
|
return app.UseMvc(routes =>
|
||||||
|
{
|
||||||
|
routes.MapRoute(
|
||||||
|
name: "default",
|
||||||
|
template: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds Mvc to the <see cref="IApplicationBuilder"/> request execution pipeline.
|
/// Adds Mvc to the <see cref="IApplicationBuilder"/> request execution pipeline.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue