diff --git a/samples/MvcSample.Web/Startup.cs b/samples/MvcSample.Web/Startup.cs
index 7410c6b95f..64afcbb810 100644
--- a/samples/MvcSample.Web/Startup.cs
+++ b/samples/MvcSample.Web/Startup.cs
@@ -2,12 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
-using System.IO;
using System.Security.Claims;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Razor;
-using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Security;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
diff --git a/samples/TagHelperSample.Web/Startup.cs b/samples/TagHelperSample.Web/Startup.cs
index 98c5de0397..4e4a8f20eb 100644
--- a/samples/TagHelperSample.Web/Startup.cs
+++ b/samples/TagHelperSample.Web/Startup.cs
@@ -26,7 +26,12 @@ namespace TagHelperSample.Web
options.AddXmlDataContractSerializerFormatter();
});
});
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Routing/RouteBuilderExtensions.cs b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Routing/RouteBuilderExtensions.cs
index 7cf2cadbd2..de737317fb 100644
--- a/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Routing/RouteBuilderExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc.WebApiCompatShim/Routing/RouteBuilderExtensions.cs
@@ -3,9 +3,10 @@
using System.Collections.Generic;
using Microsoft.AspNet.Mvc.WebApiCompatShim;
+using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Routing.Constraints;
-namespace Microsoft.AspNet.Routing
+namespace Microsoft.AspNet.Builder
{
public static class RouteBuilderExtensions
{
diff --git a/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs b/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs
index 438d916a08..679a81df05 100644
--- a/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs
+++ b/src/Microsoft.AspNet.Mvc/BuilderExtensions.cs
@@ -9,20 +9,31 @@ using Microsoft.AspNet.Routing;
namespace Microsoft.AspNet.Builder
{
+ ///
+ /// Extension methods for to add Mvc to the request execution pipeline.
+ ///
public static class BuilderExtensions
{
+ ///
+ /// Adds Mvc to the request execution pipeline.
+ ///
+ /// The .
+ /// The .
+ /// This method only supports attribute routing. To add conventional routes use
+ /// .
public static IApplicationBuilder UseMvc([NotNull] this IApplicationBuilder app)
{
return app.UseMvc(routes =>
{
- // Action style actions
- routes.MapRoute(null, "{controller}/{action}/{id?}", new { controller = "Home", action = "Index" });
-
- // Rest style actions
- routes.MapRoute(null, "{controller}/{id?}");
});
}
+ ///
+ /// Adds Mvc to the request execution pipeline.
+ ///
+ /// The .
+ /// A callback to configure Mvc routes.
+ /// The .
public static IApplicationBuilder UseMvc(
[NotNull] this IApplicationBuilder app,
[NotNull] Action configureRoutes)
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/UrlHelperTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/UrlHelperTest.cs
index 79b911f37a..cc2afb46c9 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/UrlHelperTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/UrlHelperTest.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
diff --git a/test/WebSites/ActionConstraintsWebSite/Startup.cs b/test/WebSites/ActionConstraintsWebSite/Startup.cs
index f01b2f2974..3444800f8b 100644
--- a/test/WebSites/ActionConstraintsWebSite/Startup.cs
+++ b/test/WebSites/ActionConstraintsWebSite/Startup.cs
@@ -3,7 +3,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace ActionConstraintsWebSite
diff --git a/test/WebSites/ActionResultsWebSite/Startup.cs b/test/WebSites/ActionResultsWebSite/Startup.cs
index d8c6760cf9..f481be6066 100644
--- a/test/WebSites/ActionResultsWebSite/Startup.cs
+++ b/test/WebSites/ActionResultsWebSite/Startup.cs
@@ -3,7 +3,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace ActionResultsWebSite
diff --git a/test/WebSites/ActivatorWebSite/Startup.cs b/test/WebSites/ActivatorWebSite/Startup.cs
index c48637d7f9..16b35b0df3 100644
--- a/test/WebSites/ActivatorWebSite/Startup.cs
+++ b/test/WebSites/ActivatorWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace ActivatorWebSite
diff --git a/test/WebSites/AddServicesWebSite/Startup.cs b/test/WebSites/AddServicesWebSite/Startup.cs
index 4cb90bd753..ea551fee82 100644
--- a/test/WebSites/AddServicesWebSite/Startup.cs
+++ b/test/WebSites/AddServicesWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
namespace AddServicesWebSite
{
diff --git a/test/WebSites/AntiForgeryWebSite/Startup.cs b/test/WebSites/AntiForgeryWebSite/Startup.cs
index 508c1e4378..1fa0467c35 100644
--- a/test/WebSites/AntiForgeryWebSite/Startup.cs
+++ b/test/WebSites/AntiForgeryWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace AntiForgeryWebSite
diff --git a/test/WebSites/ApiExplorerWebSite/Startup.cs b/test/WebSites/ApiExplorerWebSite/Startup.cs
index 34b77d4717..8fe6435c0c 100644
--- a/test/WebSites/ApiExplorerWebSite/Startup.cs
+++ b/test/WebSites/ApiExplorerWebSite/Startup.cs
@@ -3,7 +3,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace ApiExplorerWebSite
diff --git a/test/WebSites/ApplicationModelWebSite/Startup.cs b/test/WebSites/ApplicationModelWebSite/Startup.cs
index b736e8dc42..0773fe961a 100644
--- a/test/WebSites/ApplicationModelWebSite/Startup.cs
+++ b/test/WebSites/ApplicationModelWebSite/Startup.cs
@@ -17,7 +17,12 @@ namespace ApplicationModelWebSite
services.AddMvc(configuration);
});
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller}/{action}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/AutofacWebSite/Startup.cs b/test/WebSites/AutofacWebSite/Startup.cs
index b055590bb0..82b13cc33a 100644
--- a/test/WebSites/AutofacWebSite/Startup.cs
+++ b/test/WebSites/AutofacWebSite/Startup.cs
@@ -4,7 +4,6 @@
using System;
using Autofac;
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.DependencyInjection.Autofac;
diff --git a/test/WebSites/BasicWebSite/Startup.cs b/test/WebSites/BasicWebSite/Startup.cs
index 8ebcd53366..ee9a33d521 100644
--- a/test/WebSites/BasicWebSite/Startup.cs
+++ b/test/WebSites/BasicWebSite/Startup.cs
@@ -3,7 +3,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace BasicWebSite
diff --git a/test/WebSites/CompositeViewEngineWebSite/Startup.cs b/test/WebSites/CompositeViewEngineWebSite/Startup.cs
index 8dec22ad38..3351b3bc7d 100644
--- a/test/WebSites/CompositeViewEngineWebSite/Startup.cs
+++ b/test/WebSites/CompositeViewEngineWebSite/Startup.cs
@@ -25,7 +25,12 @@ namespace CompositeViewEngineWebSite
});
// Add MVC to the request pipeline
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/ConnegWebSite/Startup.cs b/test/WebSites/ConnegWebSite/Startup.cs
index fd4e143ecf..f3075f4dce 100644
--- a/test/WebSites/ConnegWebSite/Startup.cs
+++ b/test/WebSites/ConnegWebSite/Startup.cs
@@ -3,7 +3,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace ConnegWebSite
diff --git a/test/WebSites/CustomRouteWebSite/LocalizedRoute.cs b/test/WebSites/CustomRouteWebSite/LocalizedRoute.cs
index 61d2f85db2..638a0e96d7 100644
--- a/test/WebSites/CustomRouteWebSite/LocalizedRoute.cs
+++ b/test/WebSites/CustomRouteWebSite/LocalizedRoute.cs
@@ -4,8 +4,8 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Http;
+using Microsoft.AspNet.Routing;
namespace CustomRouteWebSite
{
diff --git a/test/WebSites/CustomRouteWebSite/Startup.cs b/test/WebSites/CustomRouteWebSite/Startup.cs
index 2d39cc65b9..af617b211f 100644
--- a/test/WebSites/CustomRouteWebSite/Startup.cs
+++ b/test/WebSites/CustomRouteWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace CustomRouteWebSite
diff --git a/test/WebSites/FilesWebSite/Startup.cs b/test/WebSites/FilesWebSite/Startup.cs
index 59c706ca1a..b178078551 100644
--- a/test/WebSites/FilesWebSite/Startup.cs
+++ b/test/WebSites/FilesWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace FilesWebSite
diff --git a/test/WebSites/FiltersWebSite/Startup.cs b/test/WebSites/FiltersWebSite/Startup.cs
index 70ea5da1c3..848e9ed791 100644
--- a/test/WebSites/FiltersWebSite/Startup.cs
+++ b/test/WebSites/FiltersWebSite/Startup.cs
@@ -50,7 +50,12 @@ namespace FiltersWebSite
app.UseMiddleware();
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/FormatterWebSite/Startup.cs b/test/WebSites/FormatterWebSite/Startup.cs
index 07ebad5684..d26a72dab9 100644
--- a/test/WebSites/FormatterWebSite/Startup.cs
+++ b/test/WebSites/FormatterWebSite/Startup.cs
@@ -3,7 +3,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace FormatterWebSite
diff --git a/test/WebSites/InlineConstraintsWebSite/Startup.cs b/test/WebSites/InlineConstraintsWebSite/Startup.cs
index 698deb6c3c..26fc58fac7 100644
--- a/test/WebSites/InlineConstraintsWebSite/Startup.cs
+++ b/test/WebSites/InlineConstraintsWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Routing.Constraints;
using Microsoft.Framework.DependencyInjection;
diff --git a/test/WebSites/LoggingWebSite/Startup.cs b/test/WebSites/LoggingWebSite/Startup.cs
index dbb5560c59..cdf7947d01 100644
--- a/test/WebSites/LoggingWebSite/Startup.cs
+++ b/test/WebSites/LoggingWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace LoggingWebSite
diff --git a/test/WebSites/ModelBindingWebSite/Startup.cs b/test/WebSites/ModelBindingWebSite/Startup.cs
index ede76f9cb0..d300caa990 100644
--- a/test/WebSites/ModelBindingWebSite/Startup.cs
+++ b/test/WebSites/ModelBindingWebSite/Startup.cs
@@ -37,7 +37,12 @@ namespace ModelBindingWebSite
app.UseErrorReporter();
// Add MVC to the request pipeline
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/MvcTagHelpersWebSite/Startup.cs b/test/WebSites/MvcTagHelpersWebSite/Startup.cs
index 516d70e552..ce76e91c61 100644
--- a/test/WebSites/MvcTagHelpersWebSite/Startup.cs
+++ b/test/WebSites/MvcTagHelpersWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace MvcTagHelpersWebSite
diff --git a/test/WebSites/PrecompilationWebSite/Startup.cs b/test/WebSites/PrecompilationWebSite/Startup.cs
index eb9a98053d..c7dfac319a 100644
--- a/test/WebSites/PrecompilationWebSite/Startup.cs
+++ b/test/WebSites/PrecompilationWebSite/Startup.cs
@@ -17,7 +17,12 @@ namespace PrecompilationWebSite
services.AddMvc(configuration);
});
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/RazorInstrumentationWebsite/Startup.cs b/test/WebSites/RazorInstrumentationWebsite/Startup.cs
index a14ea6cfba..755f65e2b6 100644
--- a/test/WebSites/RazorInstrumentationWebsite/Startup.cs
+++ b/test/WebSites/RazorInstrumentationWebsite/Startup.cs
@@ -36,7 +36,12 @@ namespace RazorInstrumentationWebSite
});
// Add MVC to the request pipeline
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/RazorViewEngineOptionsWebsite/Startup.cs b/test/WebSites/RazorViewEngineOptionsWebsite/Startup.cs
index 636c9535d7..f1b17c61c5 100644
--- a/test/WebSites/RazorViewEngineOptionsWebsite/Startup.cs
+++ b/test/WebSites/RazorViewEngineOptionsWebsite/Startup.cs
@@ -1,13 +1,11 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System.IO;
using System.Reflection;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileProviders;
using Microsoft.AspNet.Mvc.Razor;
using Microsoft.Framework.DependencyInjection;
-using Microsoft.AspNet.Routing;
namespace RazorViewEngineOptionsWebsite
{
diff --git a/test/WebSites/RazorWebSite/Startup.cs b/test/WebSites/RazorWebSite/Startup.cs
index 91a7547720..02c8d82c90 100644
--- a/test/WebSites/RazorWebSite/Startup.cs
+++ b/test/WebSites/RazorWebSite/Startup.cs
@@ -31,7 +31,12 @@ namespace RazorWebSite
});
// Add MVC to the request pipeline
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/RequestServicesWebSite/Startup.cs b/test/WebSites/RequestServicesWebSite/Startup.cs
index ccb8d7f72b..fdc6c1382e 100644
--- a/test/WebSites/RequestServicesWebSite/Startup.cs
+++ b/test/WebSites/RequestServicesWebSite/Startup.cs
@@ -22,7 +22,12 @@ namespace RequestServicesWebSite
// Initializes the RequestId service for each request
app.UseMiddleware();
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/ResponseCacheWebSite/Startup.cs b/test/WebSites/ResponseCacheWebSite/Startup.cs
index ffc8f1e3ab..271f7437cc 100644
--- a/test/WebSites/ResponseCacheWebSite/Startup.cs
+++ b/test/WebSites/ResponseCacheWebSite/Startup.cs
@@ -17,7 +17,12 @@ namespace ResponseCacheWebSite
services.AddMvc(configuration);
});
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
\ No newline at end of file
diff --git a/test/WebSites/RoutingWebSite/Startup.cs b/test/WebSites/RoutingWebSite/Startup.cs
index 099b773f8b..c67435d81f 100644
--- a/test/WebSites/RoutingWebSite/Startup.cs
+++ b/test/WebSites/RoutingWebSite/Startup.cs
@@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace RoutingWebSite
diff --git a/test/WebSites/TagHelpersWebSite/Startup.cs b/test/WebSites/TagHelpersWebSite/Startup.cs
index 6a967400cf..6b46f59b44 100644
--- a/test/WebSites/TagHelpersWebSite/Startup.cs
+++ b/test/WebSites/TagHelpersWebSite/Startup.cs
@@ -17,7 +17,12 @@ namespace TagHelpersWebSite
services.AddMvc(configuration);
});
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/UrlHelperWebSite/Startup.cs b/test/WebSites/UrlHelperWebSite/Startup.cs
index 4ff5a32509..6371112dfb 100644
--- a/test/WebSites/UrlHelperWebSite/Startup.cs
+++ b/test/WebSites/UrlHelperWebSite/Startup.cs
@@ -3,7 +3,6 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
-using Microsoft.AspNet.Routing;
using Microsoft.Framework.DependencyInjection;
namespace UrlHelperWebSite
diff --git a/test/WebSites/ValueProvidersWebSite/Startup.cs b/test/WebSites/ValueProvidersWebSite/Startup.cs
index b833dd39bb..2126afca29 100644
--- a/test/WebSites/ValueProvidersWebSite/Startup.cs
+++ b/test/WebSites/ValueProvidersWebSite/Startup.cs
@@ -25,7 +25,12 @@ namespace ValueProvidersWebSite
});
// Add MVC to the request pipeline
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/VersioningWebSite/Startup.cs b/test/WebSites/VersioningWebSite/Startup.cs
index a19a7ee669..1a615d644b 100644
--- a/test/WebSites/VersioningWebSite/Startup.cs
+++ b/test/WebSites/VersioningWebSite/Startup.cs
@@ -19,7 +19,12 @@ namespace VersioningWebSite
services.AddScoped();
});
- app.UseMvc();
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}
diff --git a/test/WebSites/ViewComponentWebSite/Startup.cs b/test/WebSites/ViewComponentWebSite/Startup.cs
index 1629fb4954..c6ea580786 100644
--- a/test/WebSites/ViewComponentWebSite/Startup.cs
+++ b/test/WebSites/ViewComponentWebSite/Startup.cs
@@ -15,7 +15,13 @@ namespace ViewComponentWebSite
{
services.AddMvc(configuration);
});
- app.UseMvc();
+
+ app.UseMvc(routes =>
+ {
+ routes.MapRoute(
+ name: "default",
+ template: "{controller=Home}/{action=Index}/{id?}");
+ });
}
}
}