aspnetcore/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs

24 lines
653 B
C#

using System;
using System.Collections.Generic;
using Microsoft.AspNet.Abstractions;
using Microsoft.AspNet.Routing;
namespace Microsoft.AspNet.Mvc
{
public static class BuilderExtensions
{
public static IBuilder UseMvc([NotNull] this IBuilder app, [NotNull] Action<IRouteCollection> configureRoutes)
{
var routes = new RouteCollection
{
DefaultHandler = new MvcRouteHandler()
};
// REVIEW: Consider adding UseMvc() that automagically adds the default MVC route
configureRoutes(routes);
return app.UseRouter(routes);
}
}
}