Delete trailing whitespace
- #EngineeringDay - Total replaced: 105 Matching files: 44 in *.cs files - Total replaced: 27 Matching files: 1 in all other files
This commit is contained in:
parent
91c3a550f1
commit
1a101d7815
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class BoolRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Routing
|
|||
public IEnumerable<IRouteConstraint> Constraints { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
/// Constrains a route parameter to represent only <see cref="DateTime"/> values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This constraint tries to parse strings by using all of the formats returned by the
|
||||
/// This constraint tries to parse strings by using all of the formats returned by the
|
||||
/// CultureInfo.InvariantCulture.DateTimeFormat.GetAllDateTimePatterns() method.
|
||||
/// For a sample on how to list all formats which are considered, please visit
|
||||
/// http://msdn.microsoft.com/en-us/library/aszyst2c(v=vs.110).aspx
|
||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class DateTimeRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class DecimalRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class DoubleRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class FloatRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class GuidRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class IntRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
|
||||
if (minLength > maxLength)
|
||||
{
|
||||
var errorMessage =
|
||||
var errorMessage =
|
||||
Resources.FormatRangeConstraint_MinShouldBeLessThanOrEqualToMax("minLength", "maxLength");
|
||||
throw new ArgumentOutOfRangeException("minLength", minLength, errorMessage);
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public int MaxLength { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public class LongRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public int MaxLength { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public long Max { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public int MinLength { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public long Min { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
public long Max { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
public bool Match([NotNull] HttpContext httpContext,
|
||||
[NotNull] IRouter route,
|
||||
[NotNull] string routeKey,
|
||||
[NotNull] IDictionary<string, object> values,
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@ namespace Microsoft.AspNet.Routing.Constraints
|
|||
/// Constraints a route parameter that must have a value.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This constraint is primarily used to enforce that a non-parameter value is present during
|
||||
/// This constraint is primarily used to enforce that a non-parameter value is present during
|
||||
/// URL generation.
|
||||
/// </remarks>
|
||||
public class RequiredRouteConstraint : IRouteConstraint
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool Match(
|
||||
[NotNull]HttpContext httpContext,
|
||||
[NotNull]IRouter route,
|
||||
[NotNull]string routeKey,
|
||||
[NotNull]IDictionary<string, object> values,
|
||||
[NotNull]HttpContext httpContext,
|
||||
[NotNull]IRouter route,
|
||||
[NotNull]string routeKey,
|
||||
[NotNull]IDictionary<string, object> values,
|
||||
RouteDirection routeDirection)
|
||||
{
|
||||
object value;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Microsoft.AspNet.Routing
|
|||
}
|
||||
|
||||
var parameterName = parameterMatch.Groups["parameterName"].Value;
|
||||
|
||||
|
||||
// Add the default value if present
|
||||
var defaultValueGroup = parameterMatch.Groups["defaultValue"];
|
||||
var defaultValue = GetDefaultValue(defaultValueGroup);
|
||||
|
|
@ -55,12 +55,12 @@ namespace Microsoft.AspNet.Routing
|
|||
// Register inline constraints if present
|
||||
var constraintGroup = parameterMatch.Groups["constraint"];
|
||||
var inlineConstraints = GetInlineConstraints(constraintGroup);
|
||||
|
||||
|
||||
return TemplatePart.CreateParameter(parameterName,
|
||||
isCatchAll,
|
||||
isOptional,
|
||||
defaultValue,
|
||||
inlineConstraints);
|
||||
inlineConstraints);
|
||||
}
|
||||
|
||||
private static string GetDefaultValue(Group defaultValueGroup)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ namespace Microsoft.AspNet.Routing.Logging.Internal
|
|||
{
|
||||
/// <summary>
|
||||
/// A formatter for use with <see cref="Microsoft.Framework.Logging.ILogger.WriteCore(
|
||||
/// Framework.Logging.LogLevel,
|
||||
/// int,
|
||||
/// object,
|
||||
/// Framework.Logging.LogLevel,
|
||||
/// int,
|
||||
/// object,
|
||||
/// Exception, Func{object, Exception, string})"/>.
|
||||
/// </summary>
|
||||
public static string Formatter(object o, Exception e)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using System.Text;
|
|||
namespace Microsoft.AspNet.Routing.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the state of
|
||||
/// Describes the state of
|
||||
/// <see cref="Microsoft.AspNet.Routing.RouteCollection.RouteAsync(RouteContext)"/>.
|
||||
/// </summary>
|
||||
public class RouteCollectionRouteAsyncValues
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ namespace Microsoft.AspNet.Routing.Logging
|
|||
{
|
||||
/// <summary>
|
||||
/// Describes the state of <see cref="RouteConstraintMatcher.Match(
|
||||
/// System.Collections.Generic.IDictionary{string, IRouteConstraint},
|
||||
/// System.Collections.Generic.IDictionary{string, object},
|
||||
/// Http.HttpContext,
|
||||
/// IRouter,
|
||||
/// RouteDirection,
|
||||
/// System.Collections.Generic.IDictionary{string, IRouteConstraint},
|
||||
/// System.Collections.Generic.IDictionary{string, object},
|
||||
/// Http.HttpContext,
|
||||
/// IRouter,
|
||||
/// RouteDirection,
|
||||
/// Framework.Logging.ILogger)"/>.
|
||||
/// </summary>
|
||||
public class RouteConstraintMatcherMatchValues
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Text;
|
|||
namespace Microsoft.AspNet.Routing.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the state of
|
||||
/// Describes the state of
|
||||
/// <see cref="Microsoft.AspNet.Builder.RouterMiddleware.Invoke(Http.HttpContext)"/>.
|
||||
/// </summary>
|
||||
public class RouterMiddlewareInvokeValues
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using System.Text;
|
|||
namespace Microsoft.AspNet.Routing.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the state of
|
||||
/// Describes the state of
|
||||
/// <see cref="Microsoft.AspNet.Routing.Template.TemplateRoute.RouteAsync(RouteContext)"/>.
|
||||
/// </summary>
|
||||
public class TemplateRouteRouteAsyncValues
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
|
|
@ -26,36 +26,36 @@
|
|||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace Microsoft.AspNet.Routing
|
|||
{
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
|
||||
return new RouteValueDictionary(value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace Microsoft.AspNet.Routing
|
|||
/// </param>
|
||||
/// <remarks>
|
||||
/// If the <paramref name="value"/> is a string, it will be converted to a <see cref="RegexRouteConstraint"/>.
|
||||
///
|
||||
///
|
||||
/// For example, the string <code>Product[0-9]+</code> will be converted to the regular expression
|
||||
/// <code>^(Product[0-9]+)</code>. See <see cref="System.Text.RegularExpressions.Regex"/> for more details.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ namespace Microsoft.AspNet.Routing
|
|||
{
|
||||
var type = obj.GetType();
|
||||
var allProperties = type.GetRuntimeProperties();
|
||||
|
||||
|
||||
// This is done to support 'new' properties that hide a property on a base class
|
||||
var orderedByDeclaringType = allProperties.OrderBy(p => p.DeclaringType == type ? 0 : 1);
|
||||
foreach (var property in orderedByDeclaringType)
|
||||
{
|
||||
if (property.GetMethod != null &&
|
||||
if (property.GetMethod != null &&
|
||||
property.GetMethod.IsPublic &&
|
||||
!property.GetMethod.IsStatic &&
|
||||
property.GetIndexParameters().Length == 0)
|
||||
|
|
@ -210,7 +210,7 @@ namespace Microsoft.AspNet.Routing
|
|||
|
||||
/// <inheritdoc />
|
||||
void ICollection<KeyValuePair<string, object>>.CopyTo(
|
||||
[NotNull] KeyValuePair<string, object>[] array,
|
||||
[NotNull] KeyValuePair<string, object>[] array,
|
||||
int arrayIndex)
|
||||
{
|
||||
((ICollection<KeyValuePair<string, object>>)_dictionary).CopyTo(array, arrayIndex);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Builder
|
|||
public RouterMiddleware(
|
||||
RequestDelegate next,
|
||||
IServiceProvider services,
|
||||
ILoggerFactory loggerFactory,
|
||||
ILoggerFactory loggerFactory,
|
||||
IRouter router)
|
||||
{
|
||||
_next = next;
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
private readonly RouteValueDictionary _filters;
|
||||
|
||||
public TemplateBindingContext(
|
||||
IReadOnlyDictionary<string, object> defaults,
|
||||
IReadOnlyDictionary<string, object> defaults,
|
||||
IDictionary<string, object> values)
|
||||
{
|
||||
if (values == null)
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
}
|
||||
else if (part.IsOptional)
|
||||
{
|
||||
// This is optional (with no default value)
|
||||
// This is optional (with no default value)
|
||||
// - there's nothing to capture here, so just move on.
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
|
||||
var rawParameter = context.Capture();
|
||||
|
||||
// At this point, we need to parse the raw name for inline constraint,
|
||||
// default values and optional parameters.
|
||||
// At this point, we need to parse the raw name for inline constraint,
|
||||
// default values and optional parameters.
|
||||
var templatePart = InlineRouteParameterParser.ParseRouteParameter(rawParameter);
|
||||
|
||||
if (templatePart.IsCatchAll && templatePart.IsOptional)
|
||||
|
|
@ -189,14 +189,14 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
if (templatePart.IsOptional && templatePart.DefaultValue != null)
|
||||
{
|
||||
// Cannot be optional and have a default value.
|
||||
// The only way to declare an optional parameter is to have a ? at the end,
|
||||
// hence we cannot have both default value and optional parameter within the template.
|
||||
// The only way to declare an optional parameter is to have a ? at the end,
|
||||
// hence we cannot have both default value and optional parameter within the template.
|
||||
// A workaround is to add it as a separate entry in the defaults argument.
|
||||
context.Error = Resources.TemplateRoute_OptionalCannotHaveDefaultValue;
|
||||
return false;
|
||||
}
|
||||
|
||||
var parameterName = templatePart.Name;
|
||||
var parameterName = templatePart.Name;
|
||||
if (IsValidParameterName(context, parameterName))
|
||||
{
|
||||
segment.Parts.Add(templatePart);
|
||||
|
|
@ -232,7 +232,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
|
||||
if (context.Current == OpenBrace)
|
||||
{
|
||||
// This is an 'escaped' brace in a literal, like "{{foo" - keep going.
|
||||
// This is an 'escaped' brace in a literal, like "{{foo" - keep going.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -254,7 +254,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
|
||||
if (context.Current == CloseBrace)
|
||||
{
|
||||
// This is an 'escaped' brace in a literal, like "{{foo" - keep going.
|
||||
// This is an 'escaped' brace in a literal, like "{{foo" - keep going.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -292,7 +292,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
for (var j = 0; j < segment.Parts.Count; j++)
|
||||
{
|
||||
var part = segment.Parts[j];
|
||||
if (part.IsParameter &&
|
||||
if (part.IsParameter &&
|
||||
part.IsCatchAll &&
|
||||
(i != segments.Count - 1 || j != segment.Parts.Count - 1))
|
||||
{
|
||||
|
|
@ -425,8 +425,8 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
}
|
||||
|
||||
public HashSet<string> ParameterNames
|
||||
{
|
||||
get { return _parameterNames; }
|
||||
{
|
||||
get { return _parameterNames; }
|
||||
}
|
||||
|
||||
public bool Back()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
};
|
||||
}
|
||||
|
||||
public static TemplatePart CreateParameter([NotNull] string name,
|
||||
public static TemplatePart CreateParameter([NotNull] string name,
|
||||
bool isCatchAll,
|
||||
bool isOptional,
|
||||
object defaultValue,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
|
||||
public TemplateRoute(
|
||||
[NotNull] IRouter target,
|
||||
string routeTemplate,
|
||||
string routeTemplate,
|
||||
IInlineConstraintResolver inlineConstraintResolver)
|
||||
: this(target,
|
||||
routeTemplate,
|
||||
|
|
@ -259,7 +259,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
private static IReadOnlyDictionary<string, IRouteConstraint> GetConstraints(
|
||||
IInlineConstraintResolver inlineConstraintResolver,
|
||||
string template,
|
||||
RouteTemplate parsedTemplate,
|
||||
RouteTemplate parsedTemplate,
|
||||
IDictionary<string, object> constraints)
|
||||
{
|
||||
var constraintBuilder = new RouteConstraintBuilder(inlineConstraintResolver, template);
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
public IDictionary<string, object> AcceptedValues { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The set of values that that were supplied for URL generation.
|
||||
/// The set of values that that were supplied for URL generation.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This combines implicit (ambient) values from the <see cref="RouteData"/> of the current request
|
||||
/// (if applicable), explictly provided values, and default values for parameters that appear in
|
||||
/// the route template.
|
||||
///
|
||||
/// Implicit (ambient) values which are invalidated due to changes in values lexically earlier in the
|
||||
///
|
||||
/// Implicit (ambient) values which are invalidated due to changes in values lexically earlier in the
|
||||
/// route template are excluded from this set.
|
||||
/// </remarks>
|
||||
public IDictionary<string, object> CombinedValues { get; set; }
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Routing
|
|||
public class VirtualPathContext
|
||||
{
|
||||
public VirtualPathContext(HttpContext httpContext,
|
||||
IDictionary<string, object> ambientValues,
|
||||
IDictionary<string, object> ambientValues,
|
||||
IDictionary<string, object> values)
|
||||
: this(httpContext, ambientValues, values, null)
|
||||
{
|
||||
|
|
@ -28,14 +28,14 @@ namespace Microsoft.AspNet.Routing
|
|||
|
||||
public string RouteName { get; private set; }
|
||||
|
||||
public IDictionary<string, object> ProvidedValues { get; set; }
|
||||
public IDictionary<string, object> ProvidedValues { get; set; }
|
||||
|
||||
public IDictionary<string, object> AmbientValues { get; private set; }
|
||||
public IDictionary<string, object> AmbientValues { get; private set; }
|
||||
|
||||
public HttpContext Context { get; private set; }
|
||||
|
||||
public bool IsBound { get; set; }
|
||||
|
||||
public IDictionary<string, object> Values { get; private set; }
|
||||
public IDictionary<string, object> Values { get; private set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
{
|
||||
// Arrange
|
||||
var constraint = new BoolRouteConstraint();
|
||||
|
||||
|
||||
// Act
|
||||
var actual = ConstraintsTestHelper.TestConstraint(constraint, parameterValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
static Expression<Func<IRouteConstraint, bool>> ConstraintMatchMethodExpression =
|
||||
static Expression<Func<IRouteConstraint, bool>> ConstraintMatchMethodExpression =
|
||||
c => c.Match(It.IsAny<HttpContext>(),
|
||||
It.IsAny<IRouter>(),
|
||||
It.IsAny<string>(),
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
|
||||
// Act
|
||||
var result = constraint.Match(
|
||||
Mock.Of<HttpContext>(),
|
||||
Mock.Of<IRouter>(),
|
||||
"area",
|
||||
Mock.Of<HttpContext>(),
|
||||
Mock.Of<IRouter>(),
|
||||
"area",
|
||||
new RouteValueDictionary(new { controller = "Home", action = "Index" }),
|
||||
direction);
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
// Act & Assert
|
||||
var ex = Assert.Throws<InvalidOperationException>(() => resolver.ResolveConstraint("custom"));
|
||||
Assert.Equal("The constraint type 'System.String' which is mapped to constraint key 'custom'"+
|
||||
" must implement the 'IRouteConstraint' interface.",
|
||||
" must implement the 'IRouteConstraint' interface.",
|
||||
ex.Message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
{
|
||||
// Arrange & Act
|
||||
var template = ParseRouteTemplate(@"some/url-{p1:int:test(3)=hello}/{p2=abc}/{p3?}");
|
||||
|
||||
|
||||
// Assert
|
||||
var parameters = template.Parameters.ToArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNet.Routing
|
|||
public class TestSink
|
||||
{
|
||||
public TestSink(
|
||||
Func<WriteContext, bool> writeEnabled = null,
|
||||
Func<WriteContext, bool> writeEnabled = null,
|
||||
Func<BeginScopeContext, bool> beginEnabled = null)
|
||||
{
|
||||
WriteEnabled = writeEnabled;
|
||||
|
|
|
|||
|
|
@ -227,10 +227,10 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
|
||||
private class IndexerProperty
|
||||
{
|
||||
public bool this[string key]
|
||||
public bool this[string key]
|
||||
{
|
||||
get { return false; }
|
||||
set {}
|
||||
get { return false; }
|
||||
set {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Routing
|
|||
var isHandled = false;
|
||||
|
||||
var sink = new TestSink(
|
||||
TestSink.EnableWithTypeName<RouterMiddleware>,
|
||||
TestSink.EnableWithTypeName<RouterMiddleware>,
|
||||
TestSink.EnableWithTypeName<RouterMiddleware>);
|
||||
var loggerFactory = new TestLoggerFactory(sink, enabled: true);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,100 +25,100 @@ namespace Microsoft.AspNet.Routing.Template.Tests
|
|||
{
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}",
|
||||
"Test/{val1}/{val2}",
|
||||
new RouteValueDictionary(new {val1 = "", val2 = ""}),
|
||||
new RouteValueDictionary(new {val2 = "SomeVal2"}),
|
||||
new RouteValueDictionary(new {val2 = "SomeVal2"}),
|
||||
null,
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}",
|
||||
"Test/{val1}/{val2}",
|
||||
new RouteValueDictionary(new {val1 = "", val2 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "a"}),
|
||||
new RouteValueDictionary(new {val1 = "a"}),
|
||||
"Test/a"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
new RouteValueDictionary(new {val1 = "", val3 = ""}),
|
||||
new RouteValueDictionary(new {val2 = "a"}),
|
||||
new RouteValueDictionary(new {val2 = "a"}),
|
||||
null
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}",
|
||||
"Test/{val1}/{val2}",
|
||||
new RouteValueDictionary(new {val1 = "", val2 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "a", val2 = "b"}),
|
||||
new RouteValueDictionary(new {val1 = "a", val2 = "b"}),
|
||||
"Test/a/b"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
new RouteValueDictionary(new {val1 = "", val2 = "", val3 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "a", val2 = "b", val3 = "c"}),
|
||||
new RouteValueDictionary(new {val1 = "a", val2 = "b", val3 = "c"}),
|
||||
"Test/a/b/c"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
new RouteValueDictionary(new {val1 = "", val2 = "", val3 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "a", val2 = "b"}),
|
||||
new RouteValueDictionary(new {val1 = "a", val2 = "b"}),
|
||||
"Test/a/b"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
new RouteValueDictionary(new {val1 = "", val2 = "", val3 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "a"}),
|
||||
new RouteValueDictionary(new {val1 = "a"}),
|
||||
"Test/a"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}",
|
||||
"Test/{val1}",
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = "", val3 = ""}),
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary(),
|
||||
"Test"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = (string)null, val3 = (string)null}),
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary(),
|
||||
"Test"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}/{val4}",
|
||||
new RouteValueDictionary(new {val1 = "21", val2 = "", val3 = "", val4 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = "11", val3 = "", val4 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = "11", val3 = "", val4 = ""}),
|
||||
"Test/42/11"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
new RouteValueDictionary(new {val1 = "21", val2 = "", val3 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "42"}),
|
||||
new RouteValueDictionary(new {val1 = "42"}),
|
||||
"Test/42"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}/{val4}",
|
||||
new RouteValueDictionary(new {val1 = "21", val2 = "", val3 = "", val4 = ""}),
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = "11"}),
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = "11"}),
|
||||
"Test/42/11"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}",
|
||||
new RouteValueDictionary(new {val1 = "21", val2 = (string)null, val3 = (string)null}),
|
||||
new RouteValueDictionary(new {val1 = "42"}),
|
||||
new RouteValueDictionary(new {val1 = "42"}),
|
||||
"Test/42"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
"Test/{val1}/{val2}/{val3}/{val4}",
|
||||
new RouteValueDictionary(new {val1 = "21", val2 = (string)null, val3 = (string)null, val4 = (string)null}),
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = "11"}),
|
||||
new RouteValueDictionary(new {val1 = "42", val2 = "11"}),
|
||||
"Test/42/11"
|
||||
},
|
||||
};
|
||||
|
|
@ -901,8 +901,8 @@ namespace Microsoft.AspNet.Routing.Template.Tests
|
|||
{
|
||||
// DevDiv Bugs 199612: UrlRouting: UrlGeneration should not append parameter to query string if it is a Constraint parameter and not a Url parameter
|
||||
RunTest(
|
||||
"{Controller}.mvc/{action}/{end}",
|
||||
null,
|
||||
"{Controller}.mvc/{action}/{end}",
|
||||
null,
|
||||
new RouteValueDictionary(new { foo = CreateHttpMethodConstraint("GET") }),
|
||||
new RouteValueDictionary(),
|
||||
new RouteValueDictionary(new { controller = "Orders", action = "Index", end = "end", foo = "GET" }),
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
{
|
||||
// Arrange
|
||||
var route = CreateRoute(
|
||||
"{controller}/{action}",
|
||||
"{controller}/{action}",
|
||||
defaults: new { action = "Index" },
|
||||
dataTokens: new { culture = "en-CA" });
|
||||
|
||||
|
|
@ -1057,7 +1057,7 @@ namespace Microsoft.AspNet.Routing.Template
|
|||
// Arrange
|
||||
var routeBuilder = CreateRouteBuilder();
|
||||
|
||||
// Act
|
||||
// Act
|
||||
routeBuilder.MapRoute("mockName",
|
||||
"{controller}/{action}",
|
||||
defaults: null,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
public void EmptyDefaultValue_WithOptionalParameter_Throws()
|
||||
{
|
||||
// Arrange
|
||||
var message = "An optional parameter cannot have default value." + Environment.NewLine +
|
||||
var message = "An optional parameter cannot have default value." + Environment.NewLine +
|
||||
"Parameter name: routeTemplate";
|
||||
var routeBuilder = CreateRouteBuilder();
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Routing.Tests
|
|||
public void NonEmptyDefaultValue_WithOptionalParameter_Throws()
|
||||
{
|
||||
// Arrange
|
||||
var message = "An optional parameter cannot have default value." + Environment.NewLine +
|
||||
var message = "An optional parameter cannot have default value." + Environment.NewLine +
|
||||
"Parameter name: routeTemplate";
|
||||
var routeBuilder = CreateRouteBuilder();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue