Routing related fixes for #55
This commit is contained in:
parent
7ab93d34e4
commit
d3407ff212
|
|
@ -46,6 +46,6 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="Template"/>.
|
/// The <see cref="Template"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Template Template { get; set; }
|
public RouteTemplate Template { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class AttributeRoutePrecedence
|
public static class AttributeRoutePrecedence
|
||||||
{
|
{
|
||||||
public static decimal Compute(Template template)
|
public static decimal Compute(RouteTemplate template)
|
||||||
{
|
{
|
||||||
// Each precedence digit corresponds to one decimal place. For example, 3 segments with precedences 2, 1,
|
// Each precedence digit corresponds to one decimal place. For example, 3 segments with precedences 2, 1,
|
||||||
// and 4 results in a combined precedence of 2.14 (decimal).
|
// and 4 results in a combined precedence of 2.14 (decimal).
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
//
|
//
|
||||||
// For a relatively simple route template, the `Template` object will hold about 500 bytes
|
// For a relatively simple route template, the `Template` object will hold about 500 bytes
|
||||||
// of memory, so sharing is worthwhile.
|
// of memory, so sharing is worthwhile.
|
||||||
var templateCache = new Dictionary<string, Template>(StringComparer.OrdinalIgnoreCase);
|
var templateCache = new Dictionary<string, RouteTemplate>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
foreach (var action in actions.Where(a => a.AttributeRouteTemplate != null))
|
foreach (var action in actions.Where(a => a.AttributeRouteTemplate != null))
|
||||||
{
|
{
|
||||||
|
|
@ -146,7 +146,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
|
|
||||||
private static RouteInfo GetRouteInfo(
|
private static RouteInfo GetRouteInfo(
|
||||||
IInlineConstraintResolver constraintResolver,
|
IInlineConstraintResolver constraintResolver,
|
||||||
Dictionary<string, Template> templateCache,
|
Dictionary<string, RouteTemplate> templateCache,
|
||||||
ActionDescriptor action)
|
ActionDescriptor action)
|
||||||
{
|
{
|
||||||
var constraint = action.RouteConstraints
|
var constraint = action.RouteConstraints
|
||||||
|
|
@ -173,7 +173,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Template parsedTemplate;
|
RouteTemplate parsedTemplate;
|
||||||
if (!templateCache.TryGetValue(action.AttributeRouteTemplate, out parsedTemplate))
|
if (!templateCache.TryGetValue(action.AttributeRouteTemplate, out parsedTemplate))
|
||||||
{
|
{
|
||||||
// Parsing with throw if the template is invalid.
|
// Parsing with throw if the template is invalid.
|
||||||
|
|
@ -228,7 +228,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
|
|
||||||
public string ErrorMessage { get; set; }
|
public string ErrorMessage { get; set; }
|
||||||
|
|
||||||
public Template ParsedTemplate { get; set; }
|
public RouteTemplate ParsedTemplate { get; set; }
|
||||||
|
|
||||||
public decimal Precedence { get; set; }
|
public decimal Precedence { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue