mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-08 18:54:43 +08:00
Grouping routes also by name
This commit is contained in:
@@ -14,12 +14,14 @@ namespace Orchard.Mvc.Routes {
|
||||
|
||||
private readonly ConcurrentDictionary<string, IList<RouteBase>> _routesByShell = new ConcurrentDictionary<string, IList<RouteBase>>();
|
||||
|
||||
public HubRoute(string area, int priority, IRunningShellTable runningShellTable) {
|
||||
public HubRoute(string name, string area, int priority, IRunningShellTable runningShellTable) {
|
||||
Priority = priority;
|
||||
Area = area;
|
||||
Name = name;
|
||||
_runningShellTable = runningShellTable;
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
public string Area { get; private set; }
|
||||
public int Priority { get; private set; }
|
||||
|
||||
@@ -87,6 +89,10 @@ namespace Orchard.Mvc.Routes {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(Name) && String.IsNullOrEmpty(other.Name) || Name == other.Name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!String.Equals(other.Area, Area, StringComparison.OrdinalIgnoreCase)) {
|
||||
return StringComparer.OrdinalIgnoreCase.Compare(other.Area, Area);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Orchard.Mvc.Routes {
|
||||
_routeCollection
|
||||
.OfType<HubRoute>()
|
||||
.ForEach(x => x.ReleaseShell(_shellSettings));
|
||||
|
||||
|
||||
// new routes are added
|
||||
foreach (var routeDescriptor in routesArray) {
|
||||
// Loading session state information.
|
||||
@@ -102,11 +102,11 @@ namespace Orchard.Mvc.Routes {
|
||||
return false;
|
||||
}
|
||||
|
||||
return routeDescriptor.Priority == hubRoute.Priority && hubRoute.Area.Equals(area, StringComparison.OrdinalIgnoreCase);
|
||||
return routeDescriptor.Priority == hubRoute.Priority && hubRoute.Area.Equals(area, StringComparison.OrdinalIgnoreCase) && hubRoute.Name == routeDescriptor.Name;
|
||||
}) as HubRoute;
|
||||
|
||||
if (matchedHubRoute == null) {
|
||||
matchedHubRoute = new HubRoute(area, routeDescriptor.Priority, _runningShellTable);
|
||||
matchedHubRoute = new HubRoute(routeDescriptor.Name, area, routeDescriptor.Priority, _runningShellTable);
|
||||
|
||||
int index;
|
||||
for (index = 0; index < _routeCollection.Count; index++) {
|
||||
|
||||
Reference in New Issue
Block a user