add docs
This commit is contained in:
parent
d78e5478a7
commit
aae9e67773
|
|
@ -6,8 +6,14 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Routing
|
namespace Microsoft.AspNet.Routing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Information about the current routing path.
|
||||||
|
/// </summary>
|
||||||
public class RouteData
|
public class RouteData
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="RouteData"/> instance.
|
||||||
|
/// </summary>
|
||||||
public RouteData()
|
public RouteData()
|
||||||
{
|
{
|
||||||
DataTokens = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
DataTokens = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
@ -15,6 +21,10 @@ namespace Microsoft.AspNet.Routing
|
||||||
Values = new RouteValueDictionary();
|
Values = new RouteValueDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="RouteData"/> instance with values copied from <paramref name="other"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">The other <see cref="RouteData"/> instance to copy.</param>
|
||||||
public RouteData([NotNull] RouteData other)
|
public RouteData([NotNull] RouteData other)
|
||||||
{
|
{
|
||||||
DataTokens = new Dictionary<string, object>(other.DataTokens, StringComparer.OrdinalIgnoreCase);
|
DataTokens = new Dictionary<string, object>(other.DataTokens, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
@ -22,10 +32,19 @@ namespace Microsoft.AspNet.Routing
|
||||||
Values = new RouteValueDictionary(other.Values);
|
Values = new RouteValueDictionary(other.Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the data tokens produced by routes on the current routing path.
|
||||||
|
/// </summary>
|
||||||
|
public IDictionary<string, object> DataTokens { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of <see cref="IRouter"/> instances on the current routing path.
|
||||||
|
/// </summary>
|
||||||
public List<IRouter> Routers { get; private set; }
|
public List<IRouter> Routers { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the set of values produced by routes on the current routing path.
|
||||||
|
/// </summary>
|
||||||
public IDictionary<string, object> Values { get; private set; }
|
public IDictionary<string, object> Values { get; private set; }
|
||||||
|
|
||||||
public IDictionary<string, object> DataTokens { get; private set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -111,7 +111,7 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
{
|
{
|
||||||
_logger.WriteValues(CreateRouteAsyncValues(
|
_logger.WriteValues(CreateRouteAsyncValues(
|
||||||
requestPath,
|
requestPath,
|
||||||
values,
|
context.RouteData.Values,
|
||||||
matchedValues: false,
|
matchedValues: false,
|
||||||
matchedConstraints: false,
|
matchedConstraints: false,
|
||||||
handled: context.IsHandled));
|
handled: context.IsHandled));
|
||||||
|
|
@ -121,9 +121,16 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var oldRouteData = context.RouteData;
|
||||||
|
|
||||||
|
var newRouteData = new RouteData(oldRouteData);
|
||||||
|
MergeValues(newRouteData.DataTokens, _dataTokens);
|
||||||
|
newRouteData.Routers.Add(_target);
|
||||||
|
MergeValues(newRouteData.Values, values);
|
||||||
|
|
||||||
if (!RouteConstraintMatcher.Match(
|
if (!RouteConstraintMatcher.Match(
|
||||||
Constraints,
|
Constraints,
|
||||||
values,
|
newRouteData.Values,
|
||||||
context.HttpContext,
|
context.HttpContext,
|
||||||
this,
|
this,
|
||||||
RouteDirection.IncomingRequest,
|
RouteDirection.IncomingRequest,
|
||||||
|
|
@ -133,7 +140,7 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
{
|
{
|
||||||
_logger.WriteValues(CreateRouteAsyncValues(
|
_logger.WriteValues(CreateRouteAsyncValues(
|
||||||
requestPath,
|
requestPath,
|
||||||
values,
|
newRouteData.Values,
|
||||||
matchedValues: true,
|
matchedValues: true,
|
||||||
matchedConstraints: false,
|
matchedConstraints: false,
|
||||||
handled: context.IsHandled));
|
handled: context.IsHandled));
|
||||||
|
|
@ -142,13 +149,6 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldRouteData = context.RouteData;
|
|
||||||
|
|
||||||
var newRouteData = new RouteData(oldRouteData);
|
|
||||||
MergeValues(newRouteData.DataTokens, _dataTokens);
|
|
||||||
newRouteData.Routers.Add(_target);
|
|
||||||
MergeValues(newRouteData.Values, values);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
context.RouteData = newRouteData;
|
context.RouteData = newRouteData;
|
||||||
|
|
@ -159,7 +159,7 @@ namespace Microsoft.AspNet.Routing.Template
|
||||||
{
|
{
|
||||||
_logger.WriteValues(CreateRouteAsyncValues(
|
_logger.WriteValues(CreateRouteAsyncValues(
|
||||||
requestPath,
|
requestPath,
|
||||||
values,
|
newRouteData.Values,
|
||||||
matchedValues: true,
|
matchedValues: true,
|
||||||
matchedConstraints: true,
|
matchedConstraints: true,
|
||||||
handled: context.IsHandled));
|
handled: context.IsHandled));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue