aspnetcore/samples/MvcSample.Web/Startup.cs

33 lines
861 B
C#

using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.RequestContainer;
using Microsoft.AspNet.Routing;
namespace MvcSample.Web
{
public class Startup
{
public void Configuration(IBuilder app)
{
app.UseServices(services =>
{
services.AddMvc();
services.AddSingleton<PassThroughAttribute, PassThroughAttribute>();
});
app.UseMvc(routes =>
{
routes.MapRoute("{area}/{controller}/{action}");
routes.MapRoute(
"{controller}/{action}",
new { controller = "Home", action = "Index" });
routes.MapRoute(
"{controller}",
new { controller = "Home" });
});
}
}
}