mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-08 00:14:31 +08:00
Remove long obsoleted IRouteProvider.GetRoutes(), see #3177
This commit is contained in:
@@ -51,12 +51,8 @@ namespace Orchard.Tests.Environment {
|
||||
_routes = routes;
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return _routes;
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
foreach (var routeDescriptor in _routes)
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
|
@@ -7,15 +7,9 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Core.Common {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -9999,
|
||||
Route = new Route(
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Priority = -9999,
|
||||
Route = new Route(
|
||||
"{*path}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Common"},
|
||||
@@ -28,9 +22,9 @@ namespace Orchard.Core.Common {
|
||||
{"area", "Common"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,28 +6,23 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Core.Dashboard {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Priority = -5,
|
||||
Route = new Route(
|
||||
"Admin",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Dashboard"},
|
||||
{"controller", "admin"},
|
||||
{"action", "index"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Dashboard"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -5,
|
||||
Route = new Route(
|
||||
"Admin",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Dashboard"},
|
||||
{"controller", "admin"},
|
||||
{"action", "index"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Dashboard"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,31 +5,25 @@ using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.Core.Feeds.Rss {
|
||||
public class Routes : IRouteProvider {
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -5,
|
||||
Route = new Route(
|
||||
"rss",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Feeds"},
|
||||
{"controller", "Feed"},
|
||||
{"action", "Index"},
|
||||
{"format", "rss"},
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Feeds"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (RouteDescriptor routeDescriptor in GetRoutes()) {
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Priority = -5,
|
||||
Route = new Route(
|
||||
"rss",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Feeds"},
|
||||
{"controller", "Feed"},
|
||||
{"action", "Index"},
|
||||
{"format", "rss"},
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Feeds"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,28 +6,23 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Core.Reports {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Priority = -5,
|
||||
Route = new Route(
|
||||
"Admin/Reports",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Reports"},
|
||||
{"controller", "Admin"},
|
||||
{"action", "Index"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Reports"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -5,
|
||||
Route = new Route(
|
||||
"Admin/Reports",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Reports"},
|
||||
{"controller", "Admin"},
|
||||
{"action", "Index"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Reports"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,14 +9,8 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Core.Settings {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Admin/Settings/{groupInfoId}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Settings"},
|
||||
@@ -31,11 +25,11 @@ namespace Orchard.Core.Settings {
|
||||
{"groupInfoId", ""}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
public class SettingsActionConstraint : IRouteConstraint {
|
||||
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
|
||||
@@ -44,7 +38,7 @@ namespace Orchard.Core.Settings {
|
||||
|
||||
if (!values.ContainsKey(parameterName))
|
||||
return false;
|
||||
|
||||
|
||||
// just hard-coding to know action name strings for now
|
||||
var potentialActionName = values[parameterName] as string;
|
||||
return !string.IsNullOrWhiteSpace(potentialActionName)
|
||||
|
@@ -17,21 +17,19 @@ namespace Orchard.Alias {
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (RouteDescriptor routeDescriptor in GetRoutes()) {
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
var distinctAreaNames = _blueprint.Controllers
|
||||
.Select(controllerBlueprint => controllerBlueprint.AreaName)
|
||||
.Distinct();
|
||||
|
||||
return distinctAreaNames.Select(areaName =>
|
||||
new RouteDescriptor {
|
||||
Priority = 80,
|
||||
Route = new AliasRoute(_aliasHolder, areaName, new MvcRouteHandler())
|
||||
}).ToList();
|
||||
var routeDescriptors = distinctAreaNames.Select(areaName =>
|
||||
new RouteDescriptor {
|
||||
Priority = 80,
|
||||
Route = new AliasRoute(_aliasHolder, areaName, new MvcRouteHandler())
|
||||
}).ToList();
|
||||
|
||||
foreach (var routeDescriptor in routeDescriptors) {
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -17,12 +17,7 @@ namespace Orchard.Blogs {
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
var routeDescriptors = new[] {
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Admin/Blogs/Create",
|
||||
@@ -211,6 +206,9 @@ namespace Orchard.Blogs {
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var routeDescriptor in routeDescriptors)
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,29 +6,25 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Dashboards {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
var routeDescriptors = new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -4,
|
||||
Route = new Route(
|
||||
"Admin",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Dashboards"},
|
||||
{"controller", "Dashboard"},
|
||||
{"action", "Display"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Dashboards"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
yield return new RouteDescriptor {
|
||||
Priority = -4,
|
||||
Route = new Route(
|
||||
"Admin",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Dashboards"},
|
||||
{"controller", "Dashboard"},
|
||||
{"action", "Display"}
|
||||
},
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Dashboards"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
|
||||
yield return new RouteDescriptor {
|
||||
Route = new Route(
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Admin/Dashboards/Settings",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Dashboards"},
|
||||
@@ -40,10 +36,10 @@ namespace Orchard.Dashboards {
|
||||
{"area", "Orchard.Dashboards"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
},
|
||||
|
||||
yield return new RouteDescriptor {
|
||||
Route = new Route(
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Admin/Dashboards/List",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Dashboards"},
|
||||
@@ -55,7 +51,11 @@ namespace Orchard.Dashboards {
|
||||
{"area", "Orchard.Dashboards"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var routeDescriptor in routeDescriptors)
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,13 +6,7 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Layouts {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var route in GetRoutes()) {
|
||||
routes.Add(route);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
yield return new RouteDescriptor {
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Admin/Layouts/{controller}/{action}/{id}",
|
||||
new RouteValueDictionary {
|
||||
@@ -25,6 +19,8 @@ namespace Orchard.Layouts {
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,13 +6,7 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Lists {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (RouteDescriptor routeDescriptor in GetRoutes()) {
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
var routeDescriptors = new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = 5,
|
||||
Route = new Route(
|
||||
@@ -90,6 +84,10 @@ namespace Orchard.Lists {
|
||||
new MvcRouteHandler())
|
||||
},
|
||||
};
|
||||
|
||||
foreach (var routeDescriptor in routeDescriptors) {
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -5,10 +5,9 @@ using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.MultiTenancy {
|
||||
public class Routes : IRouteProvider {
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"Admin/MultiTenancy/Edit/{name}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.MultiTenancy"},
|
||||
@@ -22,14 +21,9 @@ namespace Orchard.MultiTenancy {
|
||||
{"area", "Orchard.MultiTenancy"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (RouteDescriptor routeDescriptor in GetRoutes()) {
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -14,16 +14,10 @@ namespace Orchard.Azure.Authentication {
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var route in GetRoutes()) {
|
||||
routes.Add(route);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
if (IsAnyProviderSettingsValid() == false)
|
||||
return Enumerable.Empty<RouteDescriptor>();
|
||||
return;
|
||||
|
||||
return new[] {
|
||||
var routeDescriptors = new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = 11,
|
||||
Route = new Route(
|
||||
@@ -74,6 +68,10 @@ namespace Orchard.Azure.Authentication {
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var routeDescriptor in routeDescriptors) {
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsAnyProviderSettingsValid() {
|
||||
|
@@ -47,7 +47,8 @@ namespace Orchard.OutputCache.Controllers {
|
||||
// Right now, ignore generic routes.
|
||||
if (routeProvider.Value is StandardExtensionRouteProvider) continue;
|
||||
|
||||
var routes = routeProvider.Value.GetRoutes();
|
||||
var routes = new List<RouteDescriptor>();
|
||||
routeProvider.Value.GetRoutes(routes);
|
||||
var feature = routeProvider.Metadata["Feature"] as Orchard.Environment.Extensions.Models.Feature;
|
||||
|
||||
// If there is no feature, skip route.
|
||||
|
@@ -6,14 +6,9 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Recipes {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor { Priority = 5,
|
||||
Route = new Route(
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Priority = 5,
|
||||
Route = new Route(
|
||||
"Recipes/Status/{executionId}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Recipes"},
|
||||
@@ -25,8 +20,9 @@ namespace Orchard.Recipes {
|
||||
{"area", "Orchard.Recipes"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,12 +7,7 @@ namespace Orchard.Search {
|
||||
public class Routes : IRouteProvider {
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
var routeDescriptors = new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = 5,
|
||||
Route = new Route("Search/ContentPicker",
|
||||
@@ -43,6 +38,9 @@ namespace Orchard.Search {
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var routeDescriptor in routeDescriptors)
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,14 +6,8 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Setup {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Route = new Route(
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Route = new Route(
|
||||
"{controller}/{action}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Setup"},
|
||||
@@ -28,8 +22,9 @@ namespace Orchard.Setup {
|
||||
{"area", "Orchard.Setup"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,15 +6,9 @@ using Orchard.Mvc.Routes;
|
||||
namespace Orchard.Tags {
|
||||
public class Routes : IRouteProvider {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = 5,
|
||||
Route = new Route(
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Priority = 5,
|
||||
Route = new Route(
|
||||
"Tags/{tagName}",
|
||||
new RouteValueDictionary {
|
||||
{"area", "Orchard.Tags"},
|
||||
@@ -26,8 +20,9 @@ namespace Orchard.Tags {
|
||||
{"area", "Orchard.Tags"}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -70,8 +70,12 @@ namespace Orchard.Environment {
|
||||
|
||||
var pipeline = appBuilder.Build();
|
||||
var allRoutes = new List<RouteDescriptor>();
|
||||
allRoutes.AddRange(_routeProviders.SelectMany(provider => provider.GetRoutes()));
|
||||
allRoutes.AddRange(_httpRouteProviders.SelectMany(provider => provider.GetRoutes()));
|
||||
foreach (var routeProvider in _routeProviders) {
|
||||
routeProvider.GetRoutes(allRoutes);
|
||||
}
|
||||
foreach (var routeProvider in _httpRouteProviders) {
|
||||
routeProvider.GetRoutes(allRoutes);
|
||||
}
|
||||
|
||||
_routePublisher.Publish(allRoutes, pipeline);
|
||||
_modelBinderPublisher.Publish(_modelBinderProviders.SelectMany(provider => provider.GetModelBinders()));
|
||||
|
@@ -6,28 +6,23 @@ using System.Web.Routing;
|
||||
|
||||
namespace Orchard.Mvc.Routes {
|
||||
public class DefaultRouteProvider : IRouteProvider {
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
return new[] {
|
||||
new RouteDescriptor {
|
||||
Priority = -20,
|
||||
Route = new Route(
|
||||
"{controller}/{action}/{id}",
|
||||
new RouteValueDictionary {
|
||||
{"controller", "home"},
|
||||
{"action", "index"},
|
||||
{"id", ""},
|
||||
},
|
||||
new RouteValueDictionary {
|
||||
{"controller", new HomeOrAccount()}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach(var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
var routeDescriptor = new RouteDescriptor {
|
||||
Priority = -20,
|
||||
Route = new Route(
|
||||
"{controller}/{action}/{id}",
|
||||
new RouteValueDictionary {
|
||||
{"controller", "home"},
|
||||
{"action", "index"},
|
||||
{"id", ""},
|
||||
},
|
||||
new RouteValueDictionary {
|
||||
{"controller", new HomeOrAccount()}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
|
||||
//TEMP: this is hardcoded to allow base web app controllers to pass
|
||||
|
@@ -2,11 +2,6 @@
|
||||
|
||||
namespace Orchard.Mvc.Routes {
|
||||
public interface IRouteProvider : IDependency {
|
||||
/// <summary>
|
||||
/// obsolete, prefer other format for extension methods
|
||||
/// </summary>
|
||||
IEnumerable<RouteDescriptor> GetRoutes();
|
||||
|
||||
void GetRoutes(ICollection<RouteDescriptor> routes);
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
@@ -14,7 +14,7 @@ namespace Orchard.Mvc.Routes {
|
||||
_blueprint = blueprint;
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
var displayPathsPerArea = _blueprint.Controllers.GroupBy(
|
||||
x => x.AreaName,
|
||||
x => x.Feature.Descriptor.Extension);
|
||||
@@ -27,9 +27,9 @@ namespace Orchard.Mvc.Routes {
|
||||
Enum.TryParse(extensionDescriptor.SessionState, true /*ignoreCase*/, out defaultSessionState);
|
||||
|
||||
|
||||
yield return new RouteDescriptor {
|
||||
routes.Add(new RouteDescriptor {
|
||||
Priority = -10,
|
||||
SessionState = defaultSessionState,
|
||||
SessionState = defaultSessionState,
|
||||
Route = new Route(
|
||||
"Admin/" + displayPath + "/{action}/{id}",
|
||||
new RouteValueDictionary {
|
||||
@@ -43,9 +43,9 @@ namespace Orchard.Mvc.Routes {
|
||||
{"area", areaName}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
});
|
||||
|
||||
yield return new RouteDescriptor {
|
||||
routes.Add(new RouteDescriptor {
|
||||
Priority = -10,
|
||||
SessionState = defaultSessionState,
|
||||
Route = new Route(
|
||||
@@ -61,13 +61,8 @@ namespace Orchard.Mvc.Routes {
|
||||
{"area", areaName}
|
||||
},
|
||||
new MvcRouteHandler())
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,7 +3,6 @@ using Orchard.Mvc.Routes;
|
||||
|
||||
namespace Orchard.WebApi.Routes {
|
||||
public interface IHttpRouteProvider : IDependency {
|
||||
IEnumerable<RouteDescriptor> GetRoutes();
|
||||
void GetRoutes(ICollection<RouteDescriptor> routes);
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ namespace Orchard.WebApi.Routes {
|
||||
_blueprint = blueprint;
|
||||
}
|
||||
|
||||
public IEnumerable<RouteDescriptor> GetRoutes() {
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
var displayPathsPerArea = _blueprint.HttpControllers.GroupBy(
|
||||
x => x.AreaName,
|
||||
x => x.Feature.Descriptor.Extension.Path);
|
||||
@@ -21,18 +21,14 @@ namespace Orchard.WebApi.Routes {
|
||||
var areaName = item.Key;
|
||||
var displayPath = item.Distinct().Single();
|
||||
|
||||
yield return new HttpRouteDescriptor {
|
||||
var routeDescriptor = new HttpRouteDescriptor {
|
||||
Priority = -10,
|
||||
RouteTemplate = "api/" + displayPath + "/{controller}/{id}",
|
||||
Defaults = new {area = areaName, controller = "api", id = RouteParameter.Optional}
|
||||
Defaults = new { area = areaName, controller = "api", id = RouteParameter.Optional }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||
foreach (var routeDescriptor in GetRoutes())
|
||||
routes.Add(routeDescriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user