Use C# 7 features
This commit is contained in:
parent
1c4b0fcdf3
commit
c27b07ef3f
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ActionConstraints
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="IActionConstraintMetadata"/> instance.
|
/// The <see cref="IActionConstraintMetadata"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IActionConstraintMetadata Metadata { get; private set; }
|
public IActionConstraintMetadata Metadata { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether or not <see cref="Constraint"/> can be reused across requests.
|
/// Gets or sets a value indicating whether or not <see cref="Constraint"/> can be reused across requests.
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,11 @@ namespace Microsoft.AspNetCore.Mvc.ActionConstraints
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="ActionDescriptor"/> for which constraints are being created.
|
/// The <see cref="ActionDescriptor"/> for which constraints are being created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ActionDescriptor Action { get; private set; }
|
public ActionDescriptor Action { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of <see cref="ActionConstraintItem"/> objects.
|
/// The list of <see cref="ActionConstraintItem"/> objects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<ActionConstraintItem> Results { get; private set; }
|
public IList<ActionConstraintItem> Results { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -31,11 +31,11 @@ namespace Microsoft.AspNetCore.Mvc.ApiExplorer
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of actions.
|
/// The list of actions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<ActionDescriptor> Actions { get; private set; }
|
public IReadOnlyList<ActionDescriptor> Actions { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The list of resulting <see cref="ApiDescription"/>.
|
/// The list of resulting <see cref="ApiDescription"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<ApiDescription> Results { get; private set; }
|
public IList<ApiDescription> Results { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Mvc.Filters
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="IFilterMetadata"/> instance.
|
/// The <see cref="IFilterMetadata"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IFilterMetadata Filter { get; private set; }
|
public IFilterMetadata Filter { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The filter order.
|
/// The filter order.
|
||||||
|
|
@ -64,6 +64,6 @@ namespace Microsoft.AspNetCore.Mvc.Filters
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The filter scope.
|
/// The filter scope.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Scope { get; private set; }
|
public int Scope { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,13 +125,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
_providers = providers;
|
_providers = providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Func<ModelMetadata, bool> PropertyFilter
|
public Func<ModelMetadata, bool> PropertyFilter => CreatePropertyFilter();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return CreatePropertyFilter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Func<ModelMetadata, bool> CreatePropertyFilter()
|
private Func<ModelMetadata, bool> CreatePropertyFilter()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct EnumGroupAndName
|
public struct EnumGroupAndName
|
||||||
{
|
{
|
||||||
private Func<string> _name;
|
private readonly Func<string> _name;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="EnumGroupAndName"/> structure. This constructor should
|
/// Initializes a new instance of the <see cref="EnumGroupAndName"/> structure. This constructor should
|
||||||
|
|
@ -65,12 +65,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name
|
public string Name => _name();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _name();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
ErrorMessage = errorMessage ?? string.Empty;
|
ErrorMessage = errorMessage ?? string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Exception Exception { get; private set; }
|
public Exception Exception { get; }
|
||||||
|
|
||||||
public string ErrorMessage { get; private set; }
|
public string ErrorMessage { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the container type of this metadata if it represents a property, otherwise <c>null</c>.
|
/// Gets the container type of this metadata if it represents a property, otherwise <c>null</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Type ContainerType { get { return Identity.ContainerType; } }
|
public Type ContainerType => Identity.ContainerType;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the metadata of the container type that the current instance is part of.
|
/// Gets the metadata of the container type that the current instance is part of.
|
||||||
|
|
@ -56,23 +56,17 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating the kind of metadata element represented by the current instance.
|
/// Gets a value indicating the kind of metadata element represented by the current instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ModelMetadataKind MetadataKind { get { return Identity.MetadataKind; } }
|
public ModelMetadataKind MetadataKind => Identity.MetadataKind;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the model type represented by the current instance.
|
/// Gets the model type represented by the current instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Type ModelType { get { return Identity.ModelType; } }
|
public Type ModelType => Identity.ModelType;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the property name represented by the current instance.
|
/// Gets the property name represented by the current instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PropertyName
|
public string PropertyName => Identity.Name;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Identity.Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the key for the current instance.
|
/// Gets the key for the current instance.
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// Returns <c>true</c> if a <see cref="TooManyModelErrorsException"/> has been recorded;
|
/// Returns <c>true</c> if a <see cref="TooManyModelErrorsException"/> has been recorded;
|
||||||
/// otherwise <c>false</c>.
|
/// otherwise <c>false</c>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public bool HasReachedMaxErrors
|
public bool HasReachedMaxErrors => ErrorCount >= MaxAllowedErrors;
|
||||||
{
|
|
||||||
get { return ErrorCount >= MaxAllowedErrors; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the number of errors added to this instance of <see cref="ModelStateDictionary"/> via
|
/// Gets the number of errors added to this instance of <see cref="ModelStateDictionary"/> via
|
||||||
|
|
|
||||||
|
|
@ -33,13 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This property provides convenience access to <see cref="ModelMetadata.ValidatorMetadata"/>.
|
/// This property provides convenience access to <see cref="ModelMetadata.ValidatorMetadata"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public IReadOnlyList<object> ValidatorMetadata
|
public IReadOnlyList<object> ValidatorMetadata => ModelMetadata.ValidatorMetadata;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ModelMetadata.ValidatorMetadata;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of <see cref="ClientValidatorItem"/> instances. <see cref="IClientModelValidatorProvider"/>
|
/// Gets the list of <see cref="ClientValidatorItem"/> instances. <see cref="IClientModelValidatorProvider"/>
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
Message = message ?? string.Empty;
|
Message = message ?? string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string MemberName { get; private set; }
|
public string MemberName { get; }
|
||||||
|
|
||||||
public string Message { get; private set; }
|
public string Message { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This property provides convenience access to <see cref="ModelMetadata.ValidatorMetadata"/>.
|
/// This property provides convenience access to <see cref="ModelMetadata.ValidatorMetadata"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public IReadOnlyList<object> ValidatorMetadata
|
public IReadOnlyList<object> ValidatorMetadata => ModelMetadata.ValidatorMetadata;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ModelMetadata.ValidatorMetadata;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the list of <see cref="ValidatorItem"/> instances. <see cref="IModelValidatorProvider"/> instances
|
/// Gets the list of <see cref="ValidatorItem"/> instances. <see cref="IModelValidatorProvider"/> instances
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for tracking validation state to customize validation behavior for a model object.
|
/// Used for tracking validation state to customize validation behavior for a model object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ValidationStateDictionary :
|
public class ValidationStateDictionary :
|
||||||
IDictionary<object, ValidationStateEntry>,
|
IDictionary<object, ValidationStateEntry>,
|
||||||
IReadOnlyDictionary<object, ValidationStateEntry>
|
IReadOnlyDictionary<object, ValidationStateEntry>
|
||||||
{
|
{
|
||||||
private readonly Dictionary<object, ValidationStateEntry> _inner;
|
private readonly Dictionary<object, ValidationStateEntry> _inner;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="ValidationStateDictionary"/>.
|
/// Creates a new <see cref="ValidationStateDictionary"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -30,8 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ValidationStateEntry entry;
|
TryGetValue(key, out var entry);
|
||||||
TryGetValue(key, out entry);
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,58 +41,24 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Count
|
public int Count => _inner.Count;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _inner.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsReadOnly
|
public bool IsReadOnly => ((IDictionary<object, ValidationStateEntry>)_inner).IsReadOnly;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ((IDictionary<object, ValidationStateEntry>)_inner).IsReadOnly;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ICollection<object> Keys
|
public ICollection<object> Keys => ((IDictionary<object, ValidationStateEntry>)_inner).Keys;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ((IDictionary<object, ValidationStateEntry>)_inner).Keys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ICollection<ValidationStateEntry> Values
|
public ICollection<ValidationStateEntry> Values => ((IDictionary<object, ValidationStateEntry>)_inner).Values;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ((IDictionary<object, ValidationStateEntry>)_inner).Values;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
IEnumerable<object> IReadOnlyDictionary<object, ValidationStateEntry>.Keys
|
IEnumerable<object> IReadOnlyDictionary<object, ValidationStateEntry>.Keys =>
|
||||||
{
|
((IReadOnlyDictionary<object, ValidationStateEntry>)_inner).Keys;
|
||||||
get
|
|
||||||
{
|
|
||||||
return ((IReadOnlyDictionary<object, ValidationStateEntry>)_inner).Keys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
IEnumerable<ValidationStateEntry> IReadOnlyDictionary<object, ValidationStateEntry>.Values
|
IEnumerable<ValidationStateEntry> IReadOnlyDictionary<object, ValidationStateEntry>.Values =>
|
||||||
{
|
((IReadOnlyDictionary<object, ValidationStateEntry>)_inner).Values;
|
||||||
get
|
|
||||||
{
|
|
||||||
return ((IReadOnlyDictionary<object, ValidationStateEntry>)_inner).Values;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Add(KeyValuePair<object, ValidationStateEntry> item)
|
public void Add(KeyValuePair<object, ValidationStateEntry> item)
|
||||||
|
|
@ -160,7 +125,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
{
|
{
|
||||||
return ((IDictionary<object, ValidationStateEntry>)_inner).GetEnumerator();
|
return ((IDictionary<object, ValidationStateEntry>)_inner).GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ReferenceEqualityComparer : IEqualityComparer<object>
|
private class ReferenceEqualityComparer : IEqualityComparer<object>
|
||||||
{
|
{
|
||||||
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
|
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
|
||||||
|
|
|
||||||
|
|
@ -57,12 +57,12 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the <see cref="CultureInfo"/> associated with the values.
|
/// Gets or sets the <see cref="CultureInfo"/> associated with the values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CultureInfo Culture { get; private set; }
|
public CultureInfo Culture { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the values.
|
/// Gets or sets the values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StringValues Values { get; private set; }
|
public StringValues Values { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the first value based on the order values were provided in the request. Use <see cref="FirstValue"/>
|
/// Gets the first value based on the order values were provided in the request. Use <see cref="FirstValue"/>
|
||||||
|
|
@ -84,13 +84,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the number of submitted values.
|
/// Gets the number of submitted values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Length
|
public int Length => Values.Count;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Values.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ namespace Microsoft.AspNetCore.Mvc.ApiExplorer
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The group name.
|
/// The group name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GroupName { get; private set; }
|
public string GroupName { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A collection of <see cref="ApiDescription"/> items for this group.
|
/// A collection of <see cref="ApiDescription"/> items for this group.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<ApiDescription> Items { get; private set; }
|
public IReadOnlyList<ApiDescription> Items { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -30,11 +30,11 @@ namespace Microsoft.AspNetCore.Mvc.ApiExplorer
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the list of <see cref="IReadOnlyList{ApiDescriptionGroup}"/>.
|
/// Returns the list of <see cref="IReadOnlyList{ApiDescriptionGroup}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<ApiDescriptionGroup> Items { get; private set; }
|
public IReadOnlyList<ApiDescriptionGroup> Items { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the unique version of the current items.
|
/// Returns the unique version of the current items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Version { get; private set; }
|
public int Version { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -48,10 +48,7 @@ namespace Microsoft.AspNetCore.Mvc.ApiExplorer
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order
|
public int Order => -1000;
|
||||||
{
|
|
||||||
get { return -1000; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnProvidersExecuting(ApiDescriptionProviderContext context)
|
public void OnProvidersExecuting(ApiDescriptionProviderContext context)
|
||||||
|
|
@ -261,8 +258,7 @@ namespace Microsoft.AspNetCore.Mvc.ApiExplorer
|
||||||
|
|
||||||
private RouteTemplate ParseTemplate(ControllerActionDescriptor action)
|
private RouteTemplate ParseTemplate(ControllerActionDescriptor action)
|
||||||
{
|
{
|
||||||
if (action.AttributeRouteInfo != null &&
|
if (action.AttributeRouteInfo?.Template != null)
|
||||||
action.AttributeRouteInfo.Template != null)
|
|
||||||
{
|
{
|
||||||
return TemplateParser.Parse(action.AttributeRouteInfo.Template);
|
return TemplateParser.Parse(action.AttributeRouteInfo.Template);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
||||||
public sealed class AcceptVerbsAttribute : Attribute, IActionHttpMethodProvider, IRouteTemplateProvider
|
public sealed class AcceptVerbsAttribute : Attribute, IActionHttpMethodProvider, IRouteTemplateProvider
|
||||||
{
|
{
|
||||||
private readonly IEnumerable<string> _httpMethods;
|
|
||||||
private int? _order;
|
private int? _order;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -36,19 +35,13 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// <param name="methods">The HTTP methods the action supports.</param>
|
/// <param name="methods">The HTTP methods the action supports.</param>
|
||||||
public AcceptVerbsAttribute(params string[] methods)
|
public AcceptVerbsAttribute(params string[] methods)
|
||||||
{
|
{
|
||||||
_httpMethods = methods.Select(method => method.ToUpperInvariant());
|
HttpMethods = methods.Select(method => method.ToUpperInvariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the HTTP methods the action supports.
|
/// Gets the HTTP methods the action supports.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<string> HttpMethods
|
public IEnumerable<string> HttpMethods { get; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _httpMethods;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The route template. May be null.
|
/// The route template. May be null.
|
||||||
|
|
@ -56,10 +49,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
public string Route { get; set; }
|
public string Route { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
string IRouteTemplateProvider.Template
|
string IRouteTemplateProvider.Template => Route;
|
||||||
{
|
|
||||||
get { return Route; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the route order. The order determines the order of route execution. Routes with a lower
|
/// Gets the route order. The order determines the order of route execution. Routes with a lower
|
||||||
|
|
@ -74,13 +64,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
int? IRouteTemplateProvider.Order
|
int? IRouteTemplateProvider.Order => _order;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _order;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AcceptedResult : ObjectResult
|
public class AcceptedResult : ObjectResult
|
||||||
{
|
{
|
||||||
private string _location;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="AcceptedResult"/> class with the values
|
/// Initializes a new instance of the <see cref="AcceptedResult"/> class with the values
|
||||||
/// provided.
|
/// provided.
|
||||||
|
|
@ -67,17 +65,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the location at which the status of the requested content can be monitored.
|
/// Gets or sets the location at which the status of the requested content can be monitored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Location
|
public string Location { get; set; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _location;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_location = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void OnFormatting(ActionContext context)
|
public override void OnFormatting(ActionContext context)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,6 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the action.
|
/// Gets the name of the action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; private set; }
|
public string Name { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -31,9 +31,9 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public ApiExplorerModel ApiExplorer { get; set; }
|
public ApiExplorerModel ApiExplorer { get; set; }
|
||||||
|
|
||||||
public IList<ControllerModel> Controllers { get; private set; }
|
public IList<ControllerModel> Controllers { get; }
|
||||||
|
|
||||||
public IList<IFilterMetadata> Filters { get; private set; }
|
public IList<IFilterMetadata> Filters { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a set of properties associated with all actions.
|
/// Gets a set of properties associated with all actions.
|
||||||
|
|
|
||||||
|
|
@ -64,14 +64,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SuppressPathMatching { get; set; }
|
public bool SuppressPathMatching { get; set; }
|
||||||
|
|
||||||
public bool IsAbsoluteTemplate
|
public bool IsAbsoluteTemplate => Template != null && IsOverridePattern(Template);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Template != null &&
|
|
||||||
IsOverridePattern(Template);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Combines two <see cref="AttributeRouteModel"/> instances and returns
|
/// Combines two <see cref="AttributeRouteModel"/> instances and returns
|
||||||
|
|
@ -368,8 +361,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
.Replace("[[", "[")
|
.Replace("[[", "[")
|
||||||
.Replace("]]", "]");
|
.Replace("]]", "]");
|
||||||
|
|
||||||
string value;
|
if (!values.TryGetValue(token, out var value))
|
||||||
if (!values.TryGetValue(token, out value))
|
|
||||||
{
|
{
|
||||||
// Value not found
|
// Value not found
|
||||||
var message = Resources.FormatAttributeRoute_TokenReplacement_ReplacementValueNotFound(
|
var message = Resources.FormatAttributeRoute_TokenReplacement_ReplacementValueNotFound(
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
|
|
||||||
string ICommonModel.Name => ParameterName;
|
string ICommonModel.Name => ParameterName;
|
||||||
|
|
||||||
public ParameterInfo ParameterInfo { get; private set; }
|
public ParameterInfo ParameterInfo { get; }
|
||||||
|
|
||||||
public string ParameterName { get; set; }
|
public string ParameterName { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Mvc.Authorization
|
||||||
/// If<c>null</c>, the policy will be constructed using
|
/// If<c>null</c>, the policy will be constructed using
|
||||||
/// <see cref="AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider, IEnumerable{IAuthorizeData})"/>.
|
/// <see cref="AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider, IEnumerable{IAuthorizeData})"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public AuthorizationPolicy Policy { get; private set; }
|
public AuthorizationPolicy Policy { get; }
|
||||||
|
|
||||||
bool IFilterFactory.IsReusable => true;
|
bool IFilterFactory.IsReusable => true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the model name used during model binding.
|
/// Represents the model name used during model binding.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string IModelNameProvider.Name
|
string IModelNameProvider.Name => Prefix;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Prefix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Func<ModelMetadata, bool> PropertyFilter
|
public Func<ModelMetadata, bool> PropertyFilter
|
||||||
|
|
|
||||||
|
|
@ -35,57 +35,27 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="Http.HttpContext"/> for the executing action.
|
/// Gets the <see cref="Http.HttpContext"/> for the executing action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpContext HttpContext
|
public HttpContext HttpContext => ControllerContext.HttpContext;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ControllerContext.HttpContext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="HttpRequest"/> for the executing action.
|
/// Gets the <see cref="HttpRequest"/> for the executing action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpRequest Request
|
public HttpRequest Request => HttpContext?.Request;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return HttpContext?.Request;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="HttpResponse"/> for the executing action.
|
/// Gets the <see cref="HttpResponse"/> for the executing action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpResponse Response
|
public HttpResponse Response => HttpContext?.Response;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return HttpContext?.Response;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="AspNetCore.Routing.RouteData"/> for the executing action.
|
/// Gets the <see cref="AspNetCore.Routing.RouteData"/> for the executing action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RouteData RouteData
|
public RouteData RouteData => ControllerContext.RouteData;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ControllerContext.RouteData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="ModelStateDictionary"/> that contains the state of the model and of model-binding validation.
|
/// Gets the <see cref="ModelStateDictionary"/> that contains the state of the model and of model-binding validation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ModelStateDictionary ModelState
|
public ModelStateDictionary ModelState => ControllerContext?.ModelState;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ControllerContext?.ModelState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the <see cref="Mvc.ControllerContext"/>.
|
/// Gets or sets the <see cref="Mvc.ControllerContext"/>.
|
||||||
|
|
@ -222,13 +192,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="ClaimsPrincipal"/> for user associated with the executing action.
|
/// Gets the <see cref="ClaimsPrincipal"/> for user associated with the executing action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ClaimsPrincipal User
|
public ClaimsPrincipal User => HttpContext?.User;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return HttpContext?.User;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="StatusCodeResult"/> object by specifying a <paramref name="statusCode"/>.
|
/// Creates a <see cref="StatusCodeResult"/> object by specifying a <paramref name="statusCode"/>.
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="IControllerActivator"/> used to create a controller.
|
/// The <see cref="IControllerActivator"/> used to create a controller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected IControllerActivator ControllerActivator
|
protected IControllerActivator ControllerActivator => _controllerActivator;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _controllerActivator;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual object CreateController(ControllerContext context)
|
public virtual object CreateController(ControllerContext context)
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Location
|
public string Location
|
||||||
{
|
{
|
||||||
get
|
get => _location;
|
||||||
{
|
|
||||||
return _location;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
|
|
||||||
private class ParameterApplicationModelConvention : IApplicationModelConvention
|
private class ParameterApplicationModelConvention : IApplicationModelConvention
|
||||||
{
|
{
|
||||||
private IParameterModelConvention _parameterModelConvention;
|
private readonly IParameterModelConvention _parameterModelConvention;
|
||||||
|
|
||||||
public ParameterApplicationModelConvention(IParameterModelConvention parameterModelConvention)
|
public ParameterApplicationModelConvention(IParameterModelConvention parameterModelConvention)
|
||||||
{
|
{
|
||||||
|
|
@ -121,7 +121,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
|
|
||||||
private class ActionApplicationModelConvention : IApplicationModelConvention
|
private class ActionApplicationModelConvention : IApplicationModelConvention
|
||||||
{
|
{
|
||||||
private IActionModelConvention _actionModelConvention;
|
private readonly IActionModelConvention _actionModelConvention;
|
||||||
|
|
||||||
public ActionApplicationModelConvention(IActionModelConvention actionModelConvention)
|
public ActionApplicationModelConvention(IActionModelConvention actionModelConvention)
|
||||||
{
|
{
|
||||||
|
|
@ -153,7 +153,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
|
|
||||||
private class ControllerApplicationModelConvention : IApplicationModelConvention
|
private class ControllerApplicationModelConvention : IApplicationModelConvention
|
||||||
{
|
{
|
||||||
private IControllerModelConvention _controllerModelConvention;
|
private readonly IControllerModelConvention _controllerModelConvention;
|
||||||
|
|
||||||
public ControllerApplicationModelConvention(IControllerModelConvention controllerConvention)
|
public ControllerApplicationModelConvention(IControllerModelConvention controllerConvention)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] FileContents
|
public byte[] FileContents
|
||||||
{
|
{
|
||||||
get
|
get => _fileContents;
|
||||||
{
|
|
||||||
return _fileContents;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Stream FileStream
|
public Stream FileStream
|
||||||
{
|
{
|
||||||
get
|
get => _fileStream;
|
||||||
{
|
|
||||||
return _fileStream;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual string GetFormat(ActionContext context)
|
public virtual string GetFormat(ActionContext context)
|
||||||
{
|
{
|
||||||
object obj;
|
if (context.RouteData.Values.TryGetValue("format", out var obj))
|
||||||
if (context.RouteData.Values.TryGetValue("format", out obj))
|
|
||||||
{
|
{
|
||||||
// null and string.Empty are equivalent for route values.
|
// null and string.Empty are equivalent for route values.
|
||||||
var routeValue = obj?.ToString();
|
var routeValue = obj?.ToString();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
{
|
{
|
||||||
private static readonly StringSegment QualityParameter = new StringSegment("q");
|
private static readonly StringSegment QualityParameter = new StringSegment("q");
|
||||||
|
|
||||||
private MediaTypeParameterParser _parameterParser;
|
private readonly MediaTypeParameterParser _parameterParser;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a <see cref="MediaType"/> instance.
|
/// Initializes a <see cref="MediaType"/> instance.
|
||||||
|
|
@ -70,8 +70,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
|
|
||||||
_parameterParser = default(MediaTypeParameterParser);
|
_parameterParser = default(MediaTypeParameterParser);
|
||||||
|
|
||||||
StringSegment type;
|
var typeLength = GetTypeLength(mediaType, offset, out var type);
|
||||||
var typeLength = GetTypeLength(mediaType, offset, out type);
|
|
||||||
if (typeLength == 0)
|
if (typeLength == 0)
|
||||||
{
|
{
|
||||||
Type = new StringSegment();
|
Type = new StringSegment();
|
||||||
|
|
@ -85,8 +84,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
Type = type;
|
Type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringSegment subType;
|
var subTypeLength = GetSubtypeLength(mediaType, offset + typeLength, out var subType);
|
||||||
var subTypeLength = GetSubtypeLength(mediaType, offset + typeLength, out subType);
|
|
||||||
if (subTypeLength == 0)
|
if (subTypeLength == 0)
|
||||||
{
|
{
|
||||||
SubType = new StringSegment();
|
SubType = new StringSegment();
|
||||||
|
|
@ -210,7 +208,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// For the media type <c>"application/vnd.example+json"</c>, this property gives the value
|
/// For the media type <c>"application/vnd.example+json"</c>, this property gives the value
|
||||||
/// <c>"vnd.example+json"</c>.
|
/// <c>"vnd.example+json"</c>.
|
||||||
/// </example>
|
/// </example>
|
||||||
public StringSegment SubType { get; private set; }
|
public StringSegment SubType { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the subtype of the <see cref="MediaType"/>, excluding any structured syntax suffix.
|
/// Gets the subtype of the <see cref="MediaType"/>, excluding any structured syntax suffix.
|
||||||
|
|
@ -219,7 +217,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// For the media type <c>"application/vnd.example+json"</c>, this property gives the value
|
/// For the media type <c>"application/vnd.example+json"</c>, this property gives the value
|
||||||
/// <c>"vnd.example"</c>.
|
/// <c>"vnd.example"</c>.
|
||||||
/// </example>
|
/// </example>
|
||||||
public StringSegment SubTypeWithoutSuffix { get; private set; }
|
public StringSegment SubTypeWithoutSuffix { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the structured syntax suffix of the <see cref="MediaType"/> if it has one.
|
/// Gets the structured syntax suffix of the <see cref="MediaType"/> if it has one.
|
||||||
|
|
@ -228,7 +226,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// For the media type <c>"application/vnd.example+json"</c>, this property gives the value
|
/// For the media type <c>"application/vnd.example+json"</c>, this property gives the value
|
||||||
/// <c>"json"</c>.
|
/// <c>"json"</c>.
|
||||||
/// </example>
|
/// </example>
|
||||||
public StringSegment SubTypeSuffix { get; private set; }
|
public StringSegment SubTypeSuffix { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets whether this <see cref="MediaType"/> matches all subtypes.
|
/// Gets whether this <see cref="MediaType"/> matches all subtypes.
|
||||||
|
|
@ -318,8 +316,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
{
|
{
|
||||||
var parametersParser = _parameterParser;
|
var parametersParser = _parameterParser;
|
||||||
|
|
||||||
MediaTypeParameter parameter;
|
while (parametersParser.ParseNextParameter(out var parameter))
|
||||||
while (parametersParser.ParseNextParameter(out parameter))
|
|
||||||
{
|
{
|
||||||
if (parameter.HasName(parameterName))
|
if (parameter.HasName(parameterName))
|
||||||
{
|
{
|
||||||
|
|
@ -411,8 +408,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
var parser = parsedMediaType._parameterParser;
|
var parser = parsedMediaType._parameterParser;
|
||||||
|
|
||||||
var quality = 1.0d;
|
var quality = 1.0d;
|
||||||
MediaTypeParameter parameter;
|
while (parser.ParseNextParameter(out var parameter))
|
||||||
while (parser.ParseNextParameter(out parameter))
|
|
||||||
{
|
{
|
||||||
if (parameter.HasName(QualityParameter))
|
if (parameter.HasName(QualityParameter))
|
||||||
{
|
{
|
||||||
|
|
@ -512,8 +508,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
private bool ContainsAllParameters(MediaTypeParameterParser setParameters)
|
private bool ContainsAllParameters(MediaTypeParameterParser setParameters)
|
||||||
{
|
{
|
||||||
var parameterFound = true;
|
var parameterFound = true;
|
||||||
MediaTypeParameter setParameter;
|
while (setParameters.ParseNextParameter(out var setParameter) && parameterFound)
|
||||||
while (setParameters.ParseNextParameter(out setParameter) && parameterFound)
|
|
||||||
{
|
{
|
||||||
if (setParameter.HasName("q"))
|
if (setParameter.HasName("q"))
|
||||||
{
|
{
|
||||||
|
|
@ -533,8 +528,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
// We can do this because it's a struct
|
// We can do this because it's a struct
|
||||||
var subSetParameters = _parameterParser;
|
var subSetParameters = _parameterParser;
|
||||||
parameterFound = false;
|
parameterFound = false;
|
||||||
MediaTypeParameter subSetParameter;
|
while (subSetParameters.ParseNextParameter(out var subSetParameter) && !parameterFound)
|
||||||
while (subSetParameters.ParseNextParameter(out subSetParameter) && !parameterFound)
|
|
||||||
{
|
{
|
||||||
parameterFound = subSetParameter.Equals(setParameter);
|
parameterFound = subSetParameter.Equals(setParameter);
|
||||||
}
|
}
|
||||||
|
|
@ -545,8 +539,8 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
|
|
||||||
private struct MediaTypeParameterParser
|
private struct MediaTypeParameterParser
|
||||||
{
|
{
|
||||||
private string _mediaTypeBuffer;
|
private readonly string _mediaTypeBuffer;
|
||||||
private int? _length;
|
private readonly int? _length;
|
||||||
|
|
||||||
public MediaTypeParameterParser(string mediaTypeBuffer, int offset, int? length)
|
public MediaTypeParameterParser(string mediaTypeBuffer, int offset, int? length)
|
||||||
{
|
{
|
||||||
|
|
@ -589,8 +583,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringSegment name;
|
var nameLength = GetNameLength(input, startIndex, out var name);
|
||||||
var nameLength = GetNameLength(input, startIndex, out name);
|
|
||||||
|
|
||||||
var current = startIndex + nameLength;
|
var current = startIndex + nameLength;
|
||||||
|
|
||||||
|
|
@ -611,8 +604,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringSegment value;
|
var valueLength = GetValueLength(input, current, out var value);
|
||||||
var valueLength = GetValueLength(input, current, out value);
|
|
||||||
|
|
||||||
parsedValue = new MediaTypeParameter(name, value);
|
parsedValue = new MediaTypeParameter(name, value);
|
||||||
current += valueLength;
|
current += valueLength;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
public class FromBodyAttribute : Attribute, IBindingSourceMetadata
|
public class FromBodyAttribute : Attribute, IBindingSourceMetadata
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public BindingSource BindingSource { get { return BindingSource.Body; } }
|
public BindingSource BindingSource => BindingSource.Body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
public class FromFormAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
public class FromFormAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public BindingSource BindingSource { get { return BindingSource.Form; } }
|
public BindingSource BindingSource => BindingSource.Form;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
public class FromHeaderAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
public class FromHeaderAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public BindingSource BindingSource { get { return BindingSource.Header; } }
|
public BindingSource BindingSource => BindingSource.Header;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
public class FromQueryAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
public class FromQueryAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public BindingSource BindingSource { get { return BindingSource.Query; } }
|
public BindingSource BindingSource => BindingSource.Query;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
public class FromRouteAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
public class FromRouteAttribute : Attribute, IBindingSourceMetadata, IModelNameProvider
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public BindingSource BindingSource { get { return BindingSource.Path; } }
|
public BindingSource BindingSource => BindingSource.Path;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,11 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the cached <see cref="IReadOnlyList{ActionDescriptor}"/>.
|
/// Returns the cached <see cref="IReadOnlyList{ActionDescriptor}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<ActionDescriptor> Items { get; private set; }
|
public IReadOnlyList<ActionDescriptor> Items { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the unique version of the currently cached items.
|
/// Returns the unique version of the currently cached items.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Version { get; private set; }
|
public int Version { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -37,8 +37,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
|
||||||
{
|
{
|
||||||
var startCharIndex = charIndex;
|
var startCharIndex = charIndex;
|
||||||
|
|
||||||
MediaTypeSegmentWithQuality output;
|
if (TryParseValue(value, ref charIndex, out var output))
|
||||||
if (TryParseValue(value, ref charIndex, out output))
|
|
||||||
{
|
{
|
||||||
// The entry may not contain an actual value, like Accept: application/json, , */*
|
// The entry may not contain an actual value, like Accept: application/json, , */*
|
||||||
if (output.MediaType.HasValue)
|
if (output.MediaType.HasValue)
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
var cache = CurrentCache;
|
var cache = CurrentCache;
|
||||||
|
|
||||||
CacheEntry entry;
|
if (cache.Entries.TryGetValue(action, out var entry))
|
||||||
if (cache.Entries.TryGetValue(action, out entry))
|
|
||||||
{
|
{
|
||||||
return GetActionConstraintsFromEntry(entry, httpContext, action);
|
return GetActionConstraintsFromEntry(entry, httpContext, action);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -376,13 +376,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Version { get; set; }
|
public int Version { get; }
|
||||||
|
|
||||||
public string[] RouteKeys { get; set; }
|
public string[] RouteKeys { get; }
|
||||||
|
|
||||||
public Dictionary<string[], List<ActionDescriptor>> OrdinalEntries { get; set; }
|
public Dictionary<string[], List<ActionDescriptor>> OrdinalEntries { get; }
|
||||||
|
|
||||||
public Dictionary<string[], List<ActionDescriptor>> OrdinalIgnoreCaseEntries { get; set; }
|
public Dictionary<string[], List<ActionDescriptor>> OrdinalIgnoreCaseEntries { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StringArrayComparer : IEqualityComparer<string[]>
|
private class StringArrayComparer : IEqualityComparer<string[]>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_policyProvider = policyProvider;
|
_policyProvider = policyProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order { get { return -1000 + 10; } }
|
public int Order => -1000 + 10;
|
||||||
|
|
||||||
public void OnProvidersExecuted(ApplicationModelProviderContext context)
|
public void OnProvidersExecuted(ApplicationModelProviderContext context)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
public IReadOnlyList<IClientModelValidator> GetValidators(ModelMetadata metadata, IClientModelValidatorProvider validatorProvider)
|
public IReadOnlyList<IClientModelValidator> GetValidators(ModelMetadata metadata, IClientModelValidatorProvider validatorProvider)
|
||||||
{
|
{
|
||||||
CacheEntry entry;
|
if (_cacheEntries.TryGetValue(metadata, out var entry))
|
||||||
if (_cacheEntries.TryGetValue(metadata, out entry))
|
|
||||||
{
|
{
|
||||||
return GetValidatorsFromEntry(entry, metadata, validatorProvider);
|
return GetValidatorsFromEntry(entry, metadata, validatorProvider);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -474,9 +474,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
string routeName,
|
string routeName,
|
||||||
ControllerActionDescriptor actionDescriptor)
|
ControllerActionDescriptor actionDescriptor)
|
||||||
{
|
{
|
||||||
IList<ActionDescriptor> namedActionGroup;
|
if (actionsByRouteName.TryGetValue(routeName, out var namedActionGroup))
|
||||||
|
|
||||||
if (actionsByRouteName.TryGetValue(routeName, out namedActionGroup))
|
|
||||||
{
|
{
|
||||||
namedActionGroup.Add(actionDescriptor);
|
namedActionGroup.Add(actionDescriptor);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_conventions = optionsAccessor.Value.Conventions;
|
_conventions = optionsAccessor.Value.Conventions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Order
|
public int Order => -1000;
|
||||||
{
|
|
||||||
get { return -1000; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnProvidersExecuting(ActionDescriptorProviderContext context)
|
public void OnProvidersExecuting(ActionDescriptorProviderContext context)
|
||||||
|
|
@ -98,14 +95,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal protected IEnumerable<ControllerActionDescriptor> GetDescriptors()
|
protected internal IEnumerable<ControllerActionDescriptor> GetDescriptors()
|
||||||
{
|
{
|
||||||
var applicationModel = BuildModel();
|
var applicationModel = BuildModel();
|
||||||
ApplicationModelConventions.ApplyConventions(applicationModel, _conventions);
|
ApplicationModelConventions.ApplyConventions(applicationModel, _conventions);
|
||||||
return ControllerActionDescriptorBuilder.Build(applicationModel);
|
return ControllerActionDescriptorBuilder.Build(applicationModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal protected ApplicationModel BuildModel()
|
protected internal ApplicationModel BuildModel()
|
||||||
{
|
{
|
||||||
var controllerTypes = GetControllerTypes();
|
var controllerTypes = GetControllerTypes();
|
||||||
var context = new ApplicationModelProviderContext(controllerTypes);
|
var context = new ApplicationModelProviderContext(controllerTypes);
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_source = source;
|
_source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IReadOnlyList<T> Readable
|
protected IReadOnlyList<T> Readable => _copy ?? _source;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _copy ?? _source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<T> Writable
|
protected List<T> Writable
|
||||||
{
|
{
|
||||||
|
|
@ -39,31 +33,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
|
|
||||||
public T this[int index]
|
public T this[int index]
|
||||||
{
|
{
|
||||||
get
|
get => Readable[index];
|
||||||
{
|
set => Writable[index] = value;
|
||||||
return Readable[index];
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
Writable[index] = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count
|
public int Count => Readable.Count;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Readable.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsReadOnly
|
public bool IsReadOnly => false;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add(T item)
|
public void Add(T item)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
public class DefaultActionConstraintProvider : IActionConstraintProvider
|
public class DefaultActionConstraintProvider : IActionConstraintProvider
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order
|
public int Order => -1000;
|
||||||
{
|
|
||||||
get { return -1000; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnProvidersExecuting(ActionConstraintProviderContext context)
|
public void OnProvidersExecuting(ActionConstraintProviderContext context)
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order
|
public int Order => -1000;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return -1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual void OnProvidersExecuting(ApplicationModelProviderContext context)
|
public virtual void OnProvidersExecuting(ApplicationModelProviderContext context)
|
||||||
|
|
@ -485,8 +479,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
var createSelectorForSilentRouteProviders = false;
|
var createSelectorForSilentRouteProviders = false;
|
||||||
foreach (var attribute in attributes)
|
foreach (var attribute in attributes)
|
||||||
{
|
{
|
||||||
var routeTemplateProvider = attribute as IRouteTemplateProvider;
|
if (attribute is IRouteTemplateProvider routeTemplateProvider)
|
||||||
if (routeTemplateProvider != null)
|
|
||||||
{
|
{
|
||||||
if (IsSilentRouteAttribute(routeTemplateProvider))
|
if (IsSilentRouteAttribute(routeTemplateProvider))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -99,13 +99,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_providers = providers;
|
_providers = providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Func<ModelMetadata, bool> PropertyFilter
|
public Func<ModelMetadata, bool> PropertyFilter => CreatePropertyFilter();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return CreatePropertyFilter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Func<ModelMetadata, bool> CreatePropertyFilter()
|
private Func<ModelMetadata, bool> CreatePropertyFilter()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -108,21 +108,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_index = -1;
|
_index = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidationEntry Current
|
public ValidationEntry Current => _entry;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _entry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object IEnumerator.Current
|
object IEnumerator.Current => Current;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -56,21 +56,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_index = -1;
|
_index = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidationEntry Current
|
public ValidationEntry Current => _entry;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _entry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object IEnumerator.Current
|
object IEnumerator.Current => Current;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class DefaultFilterProvider : IFilterProvider
|
public class DefaultFilterProvider : IFilterProvider
|
||||||
{
|
{
|
||||||
public int Order
|
public int Order => -1000;
|
||||||
{
|
|
||||||
get { return -1000; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnProvidersExecuting(FilterProviderContext context)
|
public void OnProvidersExecuting(FilterProviderContext context)
|
||||||
|
|
|
||||||
|
|
@ -82,21 +82,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_enumerator = enumerator;
|
_enumerator = enumerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidationEntry Current
|
public ValidationEntry Current => _entry;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _entry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object IEnumerator.Current
|
object IEnumerator.Current => Current;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class FilterDescriptorOrderComparer : IComparer<FilterDescriptor>
|
public class FilterDescriptorOrderComparer : IComparer<FilterDescriptor>
|
||||||
{
|
{
|
||||||
private static readonly FilterDescriptorOrderComparer _comparer = new FilterDescriptorOrderComparer();
|
public static FilterDescriptorOrderComparer Comparer { get; } = new FilterDescriptorOrderComparer();
|
||||||
|
|
||||||
public static FilterDescriptorOrderComparer Comparer
|
|
||||||
{
|
|
||||||
get { return _comparer; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Compare(FilterDescriptor x, FilterDescriptor y)
|
public int Compare(FilterDescriptor x, FilterDescriptor y)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,18 +42,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_httpMethods = new ReadOnlyCollection<string>(methods);
|
_httpMethods = new ReadOnlyCollection<string>(methods);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<string> HttpMethods
|
public IEnumerable<string> HttpMethods => _httpMethods;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _httpMethods;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Order
|
public int Order => HttpMethodConstraintOrder;
|
||||||
{
|
|
||||||
get { return HttpMethodConstraintOrder; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Accept(ActionConstraintContext context)
|
public bool Accept(ActionConstraintContext context)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -99,10 +99,9 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
|
||||||
|
|
||||||
var current = startIndex;
|
var current = startIndex;
|
||||||
|
|
||||||
char c;
|
|
||||||
while (current < input.Length)
|
while (current < input.Length)
|
||||||
{
|
{
|
||||||
c = input[current];
|
var c = input[current];
|
||||||
|
|
||||||
if ((c == SP) || (c == Tab))
|
if ((c == SP) || (c == Tab))
|
||||||
{
|
{
|
||||||
|
|
@ -202,9 +201,8 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
|
||||||
{
|
{
|
||||||
// Only check whether we have a quoted char, if we have at least 3 characters left to read (i.e.
|
// Only check whether we have a quoted char, if we have at least 3 characters left to read (i.e.
|
||||||
// quoted char + closing char). Otherwise the closing char may be considered part of the quoted char.
|
// quoted char + closing char). Otherwise the closing char may be considered part of the quoted char.
|
||||||
var quotedPairLength = 0;
|
|
||||||
if ((current + 2 < input.Length) &&
|
if ((current + 2 < input.Length) &&
|
||||||
(GetQuotedPairLength(input, current, out quotedPairLength) == HttpParseResult.Parsed))
|
(GetQuotedPairLength(input, current, out var quotedPairLength) == HttpParseResult.Parsed))
|
||||||
{
|
{
|
||||||
// We ignore invalid quoted-pairs. Invalid quoted-pairs may mean that it looked like a quoted pair,
|
// We ignore invalid quoted-pairs. Invalid quoted-pairs may mean that it looked like a quoted pair,
|
||||||
// but we actually have a quoted-string: e.g. "\ü" ('\' followed by a char >127 - quoted-pair only
|
// but we actually have a quoted-string: e.g. "\ü" ('\' followed by a char >127 - quoted-pair only
|
||||||
|
|
@ -225,9 +223,14 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
|
||||||
return HttpParseResult.InvalidFormat;
|
return HttpParseResult.InvalidFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
var nestedLength = 0;
|
var nestedResult = GetExpressionLength(
|
||||||
var nestedResult = GetExpressionLength(input, current, openChar, closeChar,
|
input,
|
||||||
supportsNesting, ref nestedCount, out nestedLength);
|
current,
|
||||||
|
openChar,
|
||||||
|
closeChar,
|
||||||
|
supportsNesting,
|
||||||
|
ref nestedCount,
|
||||||
|
out var nestedLength);
|
||||||
|
|
||||||
switch (nestedResult)
|
switch (nestedResult)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class MvcAttributeRouteHandler : IRouter
|
public class MvcAttributeRouteHandler : IRouter
|
||||||
{
|
{
|
||||||
private IActionContextAccessor _actionContextAccessor;
|
private readonly IActionContextAccessor _actionContextAccessor;
|
||||||
private IActionInvokerFactory _actionInvokerFactory;
|
private readonly IActionInvokerFactory _actionInvokerFactory;
|
||||||
private IActionSelector _actionSelector;
|
private readonly IActionSelector _actionSelector;
|
||||||
private ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private DiagnosticSource _diagnosticSource;
|
private DiagnosticSource _diagnosticSource;
|
||||||
|
|
||||||
public MvcAttributeRouteHandler(
|
public MvcAttributeRouteHandler(
|
||||||
|
|
|
||||||
|
|
@ -552,13 +552,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Count
|
public int Count => 2;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
|
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
public class MvcRouteHandler : IRouter
|
public class MvcRouteHandler : IRouter
|
||||||
{
|
{
|
||||||
private IActionContextAccessor _actionContextAccessor;
|
private readonly IActionContextAccessor _actionContextAccessor;
|
||||||
private IActionInvokerFactory _actionInvokerFactory;
|
private readonly IActionInvokerFactory _actionInvokerFactory;
|
||||||
private IActionSelector _actionSelector;
|
private readonly IActionSelector _actionSelector;
|
||||||
private ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private DiagnosticSource _diagnosticSource;
|
private readonly DiagnosticSource _diagnosticSource;
|
||||||
|
|
||||||
public MvcRouteHandler(
|
public MvcRouteHandler(
|
||||||
IActionInvokerFactory actionInvokerFactory,
|
IActionInvokerFactory actionInvokerFactory,
|
||||||
|
|
|
||||||
|
|
@ -34,35 +34,19 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The inner stream this object delegates to.
|
/// The inner stream this object delegates to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Stream InnerStream
|
protected Stream InnerStream => _innerStream;
|
||||||
{
|
|
||||||
get { return _innerStream; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanRead
|
public override bool CanRead => _innerStream.CanRead;
|
||||||
{
|
|
||||||
get { return _innerStream.CanRead; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanSeek
|
public override bool CanSeek => _innerStream.CanSeek;
|
||||||
{
|
|
||||||
get { return _innerStream.CanSeek; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanWrite
|
public override bool CanWrite => _innerStream.CanWrite;
|
||||||
{
|
|
||||||
get { return _innerStream.CanWrite; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override long Length
|
public override long Length => _innerStream.Length;
|
||||||
{
|
|
||||||
get { return _innerStream.Length; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override long Position
|
public override long Position
|
||||||
{
|
{
|
||||||
|
|
@ -78,10 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool CanTimeout
|
public override bool CanTimeout => _innerStream.CanTimeout;
|
||||||
{
|
|
||||||
get { return _innerStream.CanTimeout; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override int WriteTimeout
|
public override int WriteTimeout
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
{
|
{
|
||||||
internal class ReferenceEqualityComparer : IEqualityComparer<object>
|
internal class ReferenceEqualityComparer : IEqualityComparer<object>
|
||||||
{
|
{
|
||||||
private static readonly ReferenceEqualityComparer _instance = new ReferenceEqualityComparer();
|
|
||||||
|
|
||||||
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
|
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
|
||||||
|
|
||||||
public static ReferenceEqualityComparer Instance
|
public static ReferenceEqualityComparer Instance { get; } = new ReferenceEqualityComparer();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public new bool Equals(object x, object y)
|
public new bool Equals(object x, object y)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -83,21 +83,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
|
||||||
_keyMappingEnumerator = keyMappings.GetEnumerator();
|
_keyMappingEnumerator = keyMappings.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValidationEntry Current
|
public ValidationEntry Current => _entry;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _entry;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object IEnumerator.Current
|
object IEnumerator.Current => Current;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Url
|
public string Url
|
||||||
{
|
{
|
||||||
get
|
get => _localUrl;
|
||||||
{
|
|
||||||
return _localUrl;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrEmpty(value))
|
||||||
|
|
|
||||||
|
|
@ -181,8 +181,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
bindingContext.ValueProvider
|
bindingContext.ValueProvider
|
||||||
};
|
};
|
||||||
|
|
||||||
object boundValue;
|
|
||||||
|
|
||||||
using (bindingContext.EnterNestedScope(
|
using (bindingContext.EnterNestedScope(
|
||||||
elementMetadata,
|
elementMetadata,
|
||||||
fieldName: bindingContext.FieldName,
|
fieldName: bindingContext.FieldName,
|
||||||
|
|
@ -193,7 +191,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
|
|
||||||
if (bindingContext.Result.IsModelSet)
|
if (bindingContext.Result.IsModelSet)
|
||||||
{
|
{
|
||||||
boundValue = bindingContext.Result.Model;
|
var boundValue = bindingContext.Result.Model;
|
||||||
boundCollection.Add(ModelBindingHelper.CastOrDefault<TElement>(boundValue));
|
boundCollection.Add(ModelBindingHelper.CastOrDefault<TElement>(boundValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -410,7 +410,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
ModelBindingContext bindingContext)
|
ModelBindingContext bindingContext)
|
||||||
{
|
{
|
||||||
var targetInvocationException = exception as TargetInvocationException;
|
var targetInvocationException = exception as TargetInvocationException;
|
||||||
if (targetInvocationException != null && targetInvocationException.InnerException != null)
|
if (targetInvocationException?.InnerException != null)
|
||||||
{
|
{
|
||||||
exception = targetInvocationException.InnerException;
|
exception = targetInvocationException.InnerException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,37 +41,13 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
|
|
||||||
private class EmptyFormCollection : IFormCollection
|
private class EmptyFormCollection : IFormCollection
|
||||||
{
|
{
|
||||||
public StringValues this[string key]
|
public StringValues this[string key] => StringValues.Empty;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return StringValues.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Count
|
public int Count => 0;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IFormFileCollection Files
|
public IFormFileCollection Files => new EmptyFormFileCollection();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new EmptyFormFileCollection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICollection<string> Keys
|
public ICollection<string> Keys => new List<string>();
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new List<string>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ContainsKey(string key)
|
public bool ContainsKey(string key)
|
||||||
{
|
{
|
||||||
|
|
@ -97,23 +73,11 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
|
|
||||||
private class EmptyFormFileCollection : List<IFormFile>, IFormFileCollection
|
private class EmptyFormFileCollection : List<IFormFile>, IFormFileCollection
|
||||||
{
|
{
|
||||||
public IFormFile this[string name]
|
public IFormFile this[string name] => null;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IFormFile GetFile(string name)
|
public IFormFile GetFile(string name) => null;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IReadOnlyList<IFormFile> IFormFileCollection.GetFiles(string name)
|
IReadOnlyList<IFormFile> IFormFileCollection.GetFiles(string name) => null;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -23,6 +23,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="BindingBehavior"/> to apply.
|
/// Gets the <see cref="BindingBehavior"/> to apply.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BindingBehavior Behavior { get; private set; }
|
public BindingBehavior Behavior { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,25 +22,13 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The prefix which is used while generating the property filter.
|
/// The prefix which is used while generating the property filter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string Prefix
|
public virtual string Prefix => string.Empty;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Expressions which can be used to generate property filter which can filter model
|
/// Expressions which can be used to generate property filter which can filter model
|
||||||
/// properties.
|
/// properties.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual IEnumerable<Expression<Func<TModel, object>>> PropertyIncludeExpressions
|
public virtual IEnumerable<Expression<Func<TModel, object>>> PropertyIncludeExpressions => null;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual Func<ModelMetadata, bool> PropertyFilter
|
public virtual Func<ModelMetadata, bool> PropertyFilter
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
public class FormValueProvider : BindingSourceValueProvider, IEnumerableValueProvider
|
public class FormValueProvider : BindingSourceValueProvider, IEnumerableValueProvider
|
||||||
{
|
{
|
||||||
private readonly CultureInfo _culture;
|
private readonly CultureInfo _culture;
|
||||||
|
private readonly IFormCollection _values;
|
||||||
private PrefixContainer _prefixContainer;
|
private PrefixContainer _prefixContainer;
|
||||||
private IFormCollection _values;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a value provider for <see cref="IFormCollection"/>.
|
/// Creates a value provider for <see cref="IFormCollection"/>.
|
||||||
|
|
@ -44,13 +44,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
_culture = culture;
|
_culture = culture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CultureInfo Culture
|
public CultureInfo Culture => _culture;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _culture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected PrefixContainer PrefixContainer
|
protected PrefixContainer PrefixContainer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -331,8 +331,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
var memberExpression = (MemberExpression)expression;
|
var memberExpression = (MemberExpression)expression;
|
||||||
var memberInfo = memberExpression.Member as PropertyInfo;
|
if (memberExpression.Member is PropertyInfo memberInfo)
|
||||||
if (memberInfo != null)
|
|
||||||
{
|
{
|
||||||
if (memberExpression.Expression.NodeType != ExpressionType.Parameter)
|
if (memberExpression.Expression.NodeType != ExpressionType.Parameter)
|
||||||
{
|
{
|
||||||
|
|
@ -531,8 +530,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Internal
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var collection = model as ICollection<T>;
|
if (model is ICollection<T> collection && !collection.IsReadOnly)
|
||||||
if (collection != null && !collection.IsReadOnly)
|
|
||||||
{
|
{
|
||||||
// Can use the existing collection.
|
// Can use the existing collection.
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -615,8 +613,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does collection exist and can it be reused?
|
// Does collection exist and can it be reused?
|
||||||
var collection = model as ICollection<T>;
|
if (model is ICollection<T> collection && !collection.IsReadOnly)
|
||||||
if (collection != null && !collection.IsReadOnly)
|
|
||||||
{
|
{
|
||||||
collection.Clear();
|
collection.Clear();
|
||||||
|
|
||||||
|
|
@ -739,8 +736,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Internal
|
||||||
destinationType = UnwrapNullableType(destinationType);
|
destinationType = UnwrapNullableType(destinationType);
|
||||||
|
|
||||||
// if this is a user-input value but the user didn't type anything, return no value
|
// if this is a user-input value but the user didn't type anything, return no value
|
||||||
var valueAsString = value as string;
|
if (value is string valueAsString && string.IsNullOrWhiteSpace(valueAsString))
|
||||||
if (valueAsString != null && string.IsNullOrWhiteSpace(valueAsString))
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DefaultModelBindingMessageProvider ModelBindingMessageProvider
|
public DefaultModelBindingMessageProvider ModelBindingMessageProvider
|
||||||
{
|
{
|
||||||
get
|
get => _messageProvider;
|
||||||
{
|
|
||||||
return _messageProvider;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
|
||||||
|
|
@ -88,22 +88,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the set of attributes for the current instance.
|
/// Gets the set of attributes for the current instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ModelAttributes Attributes
|
public ModelAttributes Attributes => _details.ModelAttributes;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _details.ModelAttributes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override ModelMetadata ContainerMetadata
|
public override ModelMetadata ContainerMetadata => _details.ContainerMetadata;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _details.ContainerMetadata;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="Metadata.BindingMetadata"/> for the current instance.
|
/// Gets the <see cref="Metadata.BindingMetadata"/> for the current instance.
|
||||||
|
|
@ -188,49 +176,19 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override BindingSource BindingSource
|
public override BindingSource BindingSource => BindingMetadata.BindingSource;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return BindingMetadata.BindingSource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string BinderModelName
|
public override string BinderModelName => BindingMetadata.BinderModelName;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return BindingMetadata.BinderModelName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Type BinderType
|
public override Type BinderType => BindingMetadata.BinderType;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return BindingMetadata.BinderType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool ConvertEmptyStringToNull
|
public override bool ConvertEmptyStringToNull => DisplayMetadata.ConvertEmptyStringToNull;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.ConvertEmptyStringToNull;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string DataTypeName
|
public override string DataTypeName => DisplayMetadata.DataTypeName;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.DataTypeName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Description
|
public override string Description
|
||||||
|
|
@ -247,13 +205,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string DisplayFormatString
|
public override string DisplayFormatString => DisplayMetadata.DisplayFormatString;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.DisplayFormatString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string DisplayName
|
public override string DisplayName
|
||||||
|
|
@ -270,13 +222,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string EditFormatString
|
public override string EditFormatString => DisplayMetadata.EditFormatString;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.EditFormatString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override ModelMetadata ElementMetadata
|
public override ModelMetadata ElementMetadata
|
||||||
|
|
@ -294,48 +240,19 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IEnumerable<KeyValuePair<EnumGroupAndName, string>> EnumGroupedDisplayNamesAndValues
|
public override IEnumerable<KeyValuePair<EnumGroupAndName, string>> EnumGroupedDisplayNamesAndValues
|
||||||
{
|
=> DisplayMetadata.EnumGroupedDisplayNamesAndValues;
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.EnumGroupedDisplayNamesAndValues;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IReadOnlyDictionary<string, string> EnumNamesAndValues
|
public override IReadOnlyDictionary<string, string> EnumNamesAndValues => DisplayMetadata.EnumNamesAndValues;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.EnumNamesAndValues;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool HasNonDefaultEditFormat
|
public override bool HasNonDefaultEditFormat => DisplayMetadata.HasNonDefaultEditFormat;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.HasNonDefaultEditFormat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool HideSurroundingHtml
|
public override bool HideSurroundingHtml => DisplayMetadata.HideSurroundingHtml;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.HideSurroundingHtml;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool HtmlEncode
|
public override bool HtmlEncode => DisplayMetadata.HtmlEncode;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.HtmlEncode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool IsBindingAllowed
|
public override bool IsBindingAllowed
|
||||||
|
|
@ -375,22 +292,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool IsEnum
|
public override bool IsEnum => DisplayMetadata.IsEnum;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.IsEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool IsFlagsEnum
|
public override bool IsFlagsEnum => DisplayMetadata.IsFlagsEnum;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.IsFlagsEnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool IsReadOnly
|
public override bool IsReadOnly
|
||||||
|
|
@ -440,31 +345,14 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override ModelBindingMessageProvider ModelBindingMessageProvider
|
public override ModelBindingMessageProvider ModelBindingMessageProvider =>
|
||||||
{
|
BindingMetadata.ModelBindingMessageProvider;
|
||||||
get
|
|
||||||
{
|
|
||||||
return BindingMetadata.ModelBindingMessageProvider;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string NullDisplayText
|
public override string NullDisplayText => DisplayMetadata.NullDisplayText;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.NullDisplayText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override int Order
|
public override int Order => DisplayMetadata.Order;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.Order;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string Placeholder
|
public override string Placeholder
|
||||||
|
|
@ -497,58 +385,22 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IPropertyFilterProvider PropertyFilterProvider
|
public override IPropertyFilterProvider PropertyFilterProvider => BindingMetadata.PropertyFilterProvider;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return BindingMetadata.PropertyFilterProvider;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool ShowForDisplay
|
public override bool ShowForDisplay => DisplayMetadata.ShowForDisplay;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.ShowForDisplay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool ShowForEdit
|
public override bool ShowForEdit => DisplayMetadata.ShowForEdit;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.ShowForEdit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string SimpleDisplayProperty
|
public override string SimpleDisplayProperty => DisplayMetadata.SimpleDisplayProperty;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.SimpleDisplayProperty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string TemplateHint
|
public override string TemplateHint => DisplayMetadata.TemplateHint;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return DisplayMetadata.TemplateHint;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override IPropertyValidationFilter PropertyValidationFilter
|
public override IPropertyValidationFilter PropertyValidationFilter => ValidationMetadata.PropertyValidationFilter;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ValidationMetadata.PropertyValidationFilter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool ValidateChildren
|
public override bool ValidateChildren
|
||||||
|
|
@ -590,22 +442,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Func<object, object> PropertyGetter
|
public override Func<object, object> PropertyGetter => _details.PropertyGetter;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _details.PropertyGetter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Action<object, object> PropertySetter
|
public override Action<object, object> PropertySetter => _details.PropertySetter;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _details.PropertySetter;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override ModelMetadata GetMetadataForType(Type modelType)
|
public override ModelMetadata GetMetadataForType(Type modelType)
|
||||||
|
|
|
||||||
|
|
@ -251,9 +251,9 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
Details = details;
|
Details = details;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelMetadata Metadata { get; private set; }
|
public ModelMetadata Metadata { get; }
|
||||||
|
|
||||||
public DefaultMetadataDetails Details { get; private set; }
|
public DefaultMetadataDetails Details { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ModelMetadataIdentityComparer : IEqualityComparer<ModelMetadataIdentity>
|
private class ModelMetadataIdentityComparer : IEqualityComparer<ModelMetadataIdentity>
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
public class QueryStringValueProvider : BindingSourceValueProvider, IEnumerableValueProvider
|
public class QueryStringValueProvider : BindingSourceValueProvider, IEnumerableValueProvider
|
||||||
{
|
{
|
||||||
private readonly CultureInfo _culture;
|
private readonly CultureInfo _culture;
|
||||||
|
private readonly IQueryCollection _values;
|
||||||
private PrefixContainer _prefixContainer;
|
private PrefixContainer _prefixContainer;
|
||||||
private IQueryCollection _values;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a value provider for <see cref="IQueryCollection"/>.
|
/// Creates a value provider for <see cref="IQueryCollection"/>.
|
||||||
|
|
@ -44,13 +44,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
_culture = culture;
|
_culture = culture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CultureInfo Culture
|
public CultureInfo Culture => _culture;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _culture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected PrefixContainer PrefixContainer
|
protected PrefixContainer PrefixContainer
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
private readonly ActionContext _actionContext;
|
private readonly ActionContext _actionContext;
|
||||||
private readonly ModelStateDictionary _modelState;
|
private readonly ModelStateDictionary _modelState;
|
||||||
private readonly ValidationStateDictionary _validationState;
|
private readonly ValidationStateDictionary _validationState;
|
||||||
|
private readonly ValidationStack _currentPath;
|
||||||
|
|
||||||
private object _container;
|
private object _container;
|
||||||
private string _key;
|
private string _key;
|
||||||
|
|
@ -28,8 +29,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
private ModelMetadata _metadata;
|
private ModelMetadata _metadata;
|
||||||
private IValidationStrategy _strategy;
|
private IValidationStrategy _strategy;
|
||||||
|
|
||||||
private ValidationStack _currentPath;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="ValidationVisitor"/>.
|
/// Creates a new <see cref="ValidationVisitor"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int MaxModelValidationErrors
|
public int MaxModelValidationErrors
|
||||||
{
|
{
|
||||||
get { return _maxModelStateErrors; }
|
get => _maxModelStateErrors;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FileName
|
public string FileName
|
||||||
{
|
{
|
||||||
get
|
get => _fileName;
|
||||||
{
|
|
||||||
return _fileName;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Url
|
public string Url
|
||||||
{
|
{
|
||||||
get
|
get => _url;
|
||||||
{
|
|
||||||
return _url;
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrEmpty(value))
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,8 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Duration
|
public int Duration
|
||||||
{
|
{
|
||||||
get
|
get => _duration ?? 0;
|
||||||
{
|
set => _duration = value;
|
||||||
return _duration ?? 0;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_duration = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -44,14 +38,8 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ResponseCacheLocation Location
|
public ResponseCacheLocation Location
|
||||||
{
|
{
|
||||||
get
|
get => _location ?? ResponseCacheLocation.Any;
|
||||||
{
|
set => _location = value;
|
||||||
return _location ?? ResponseCacheLocation.Any;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_location = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -62,14 +50,8 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool NoStore
|
public bool NoStore
|
||||||
{
|
{
|
||||||
get
|
get => _noStore ?? false;
|
||||||
{
|
set => _noStore = value;
|
||||||
return _noStore ?? false;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_noStore = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Template { get; private set; }
|
public string Template { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the route order. The order determines the order of route execution. Routes with a lower order
|
/// Gets the route order. The order determines the order of route execution. Routes with a lower order
|
||||||
|
|
@ -44,13 +44,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
int? IRouteTemplateProvider.Order
|
int? IRouteTemplateProvider.Order => _order;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _order;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
|
||||||
public abstract class HttpMethodAttribute : Attribute, IActionHttpMethodProvider, IRouteTemplateProvider
|
public abstract class HttpMethodAttribute : Attribute, IActionHttpMethodProvider, IRouteTemplateProvider
|
||||||
{
|
{
|
||||||
private readonly IEnumerable<string> _httpMethods;
|
|
||||||
private int? _order;
|
private int? _order;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -42,21 +41,15 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
throw new ArgumentNullException(nameof(httpMethods));
|
throw new ArgumentNullException(nameof(httpMethods));
|
||||||
}
|
}
|
||||||
|
|
||||||
_httpMethods = httpMethods;
|
HttpMethods = httpMethods;
|
||||||
Template = template;
|
Template = template;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IEnumerable<string> HttpMethods
|
public IEnumerable<string> HttpMethods { get; }
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _httpMethods;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Template { get; private set; }
|
public string Template { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the route order. The order determines the order of route execution. Routes with a lower
|
/// Gets the route order. The order determines the order of route execution. Routes with a lower
|
||||||
|
|
@ -71,13 +64,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
int? IRouteTemplateProvider.Order
|
int? IRouteTemplateProvider.Order => _order;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _order;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,9 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
Items = items;
|
Items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Version { get; private set; }
|
public int Version { get; }
|
||||||
|
|
||||||
public string[] Items { get; private set; }
|
public string[] Items { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the HTTP status code.
|
/// Gets the HTTP status code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int StatusCode { get; private set; }
|
public int StatusCode { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void ExecuteResult(ActionContext context)
|
public override void ExecuteResult(ActionContext context)
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ namespace Microsoft.AspNetCore.Mvc.Cors
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CorsAuthorizationFilter : ICorsAuthorizationFilter
|
public class CorsAuthorizationFilter : ICorsAuthorizationFilter
|
||||||
{
|
{
|
||||||
private ICorsService _corsService;
|
private readonly ICorsService _corsService;
|
||||||
private ICorsPolicyProvider _corsPolicyProvider;
|
private readonly ICorsPolicyProvider _corsPolicyProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of <see cref="CorsAuthorizationFilter"/>.
|
/// Creates a new instance of <see cref="CorsAuthorizationFilter"/>.
|
||||||
|
|
@ -38,16 +38,9 @@ namespace Microsoft.AspNetCore.Mvc.Cors
|
||||||
public string PolicyName { get; set; }
|
public string PolicyName { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order
|
// Since clients' preflight requests would not have data to authenticate requests, this
|
||||||
{
|
// filter must run before any other authorization filters.
|
||||||
get
|
public int Order => int.MinValue + 100;
|
||||||
{
|
|
||||||
// Since clients' preflight requests would not have data to authenticate requests, this
|
|
||||||
// filter must run before any other authorization filters.
|
|
||||||
return int.MinValue + 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task OnAuthorizationAsync(Filters.AuthorizationFilterContext context)
|
public async Task OnAuthorizationAsync(Filters.AuthorizationFilterContext context)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.Cors.Internal
|
||||||
{
|
{
|
||||||
public class CorsApplicationModelProvider : IApplicationModelProvider
|
public class CorsApplicationModelProvider : IApplicationModelProvider
|
||||||
{
|
{
|
||||||
public int Order { get { return -1000 + 10; } }
|
public int Order => -1000 + 10;
|
||||||
|
|
||||||
public void OnProvidersExecuted(ApplicationModelProviderContext context)
|
public void OnProvidersExecuted(ApplicationModelProviderContext context)
|
||||||
{
|
{
|
||||||
|
|
@ -28,18 +28,15 @@ namespace Microsoft.AspNetCore.Mvc.Cors.Internal
|
||||||
throw new ArgumentNullException(nameof(context));
|
throw new ArgumentNullException(nameof(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnableCorsAttribute enableCors;
|
|
||||||
IDisableCorsAttribute disableCors;
|
|
||||||
|
|
||||||
foreach (var controllerModel in context.Result.Controllers)
|
foreach (var controllerModel in context.Result.Controllers)
|
||||||
{
|
{
|
||||||
enableCors = controllerModel.Attributes.OfType<IEnableCorsAttribute>().FirstOrDefault();
|
var enableCors = controllerModel.Attributes.OfType<IEnableCorsAttribute>().FirstOrDefault();
|
||||||
if (enableCors != null)
|
if (enableCors != null)
|
||||||
{
|
{
|
||||||
controllerModel.Filters.Add(new CorsAuthorizationFilterFactory(enableCors.PolicyName));
|
controllerModel.Filters.Add(new CorsAuthorizationFilterFactory(enableCors.PolicyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
disableCors = controllerModel.Attributes.OfType<IDisableCorsAttribute>().FirstOrDefault();
|
var disableCors = controllerModel.Attributes.OfType<IDisableCorsAttribute>().FirstOrDefault();
|
||||||
if (disableCors != null)
|
if (disableCors != null)
|
||||||
{
|
{
|
||||||
controllerModel.Filters.Add(new DisableCorsAuthorizationFilter());
|
controllerModel.Filters.Add(new DisableCorsAuthorizationFilter());
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,9 @@ namespace Microsoft.AspNetCore.Mvc.Cors.Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order
|
// Since clients' preflight requests would not have data to authenticate requests, this
|
||||||
{
|
// filter must run before any other authorization filters.
|
||||||
get
|
public int Order => int.MinValue + 100;
|
||||||
{
|
|
||||||
// Since clients' preflight requests would not have data to authenticate requests, this
|
|
||||||
// filter must run before any other authorization filters.
|
|
||||||
return int.MinValue + 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsReusable => true;
|
public bool IsReusable => true;
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,9 @@ namespace Microsoft.AspNetCore.Mvc.Cors.Internal
|
||||||
public class DisableCorsAuthorizationFilter : ICorsAuthorizationFilter
|
public class DisableCorsAuthorizationFilter : ICorsAuthorizationFilter
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public int Order
|
// Since clients' preflight requests would not have data to authenticate requests, this
|
||||||
{
|
// filter must run before any other authorization filters.
|
||||||
get
|
public int Order => int.MinValue + 100;
|
||||||
{
|
|
||||||
// Since clients' preflight requests would not have data to authenticate requests, this
|
|
||||||
// filter must run before any other authorization filters.
|
|
||||||
return int.MinValue + 100;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
public Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Mvc.DataAnnotations.Internal
|
||||||
|
|
||||||
// DisplayName
|
// DisplayName
|
||||||
// DisplayAttribute has precendence over DisplayNameAttribute.
|
// DisplayAttribute has precendence over DisplayNameAttribute.
|
||||||
if (displayAttribute != null && displayAttribute.GetName() != null)
|
if (displayAttribute?.GetName() != null)
|
||||||
{
|
{
|
||||||
if (localizer != null &&
|
if (localizer != null &&
|
||||||
!string.IsNullOrEmpty(displayAttribute.Name) &&
|
!string.IsNullOrEmpty(displayAttribute.Name) &&
|
||||||
|
|
|
||||||
|
|
@ -99,14 +99,12 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Json.Internal
|
||||||
|
|
||||||
var response = context.HttpContext.Response;
|
var response = context.HttpContext.Response;
|
||||||
|
|
||||||
string resolvedContentType;
|
|
||||||
Encoding resolvedContentTypeEncoding;
|
|
||||||
ResponseContentTypeHelper.ResolveContentTypeAndEncoding(
|
ResponseContentTypeHelper.ResolveContentTypeAndEncoding(
|
||||||
result.ContentType,
|
result.ContentType,
|
||||||
response.ContentType,
|
response.ContentType,
|
||||||
DefaultContentType,
|
DefaultContentType,
|
||||||
out resolvedContentType,
|
out var resolvedContentType,
|
||||||
out resolvedContentTypeEncoding);
|
out var resolvedContentTypeEncoding);
|
||||||
|
|
||||||
response.ContentType = resolvedContentType;
|
response.ContentType = resolvedContentType;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,8 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
jsonReader.CloseInput = false;
|
jsonReader.CloseInput = false;
|
||||||
|
|
||||||
var successful = true;
|
var successful = true;
|
||||||
EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> errorHandler = (sender, eventArgs) =>
|
|
||||||
|
void ErrorHandler(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
successful = false;
|
successful = false;
|
||||||
|
|
||||||
|
|
@ -180,11 +181,11 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
// Failure to do so can cause the exception to be rethrown at every recursive level and
|
// Failure to do so can cause the exception to be rethrown at every recursive level and
|
||||||
// overflow the stack for x64 CLR processes
|
// overflow the stack for x64 CLR processes
|
||||||
eventArgs.ErrorContext.Handled = true;
|
eventArgs.ErrorContext.Handled = true;
|
||||||
};
|
}
|
||||||
|
|
||||||
var type = context.ModelType;
|
var type = context.ModelType;
|
||||||
var jsonSerializer = CreateJsonSerializer();
|
var jsonSerializer = CreateJsonSerializer();
|
||||||
jsonSerializer.Error += errorHandler;
|
jsonSerializer.Error += ErrorHandler;
|
||||||
object model;
|
object model;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -193,7 +194,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
// Clean up the error handler since CreateJsonSerializer() pools instances.
|
// Clean up the error handler since CreateJsonSerializer() pools instances.
|
||||||
jsonSerializer.Error -= errorHandler;
|
jsonSerializer.Error -= ErrorHandler;
|
||||||
ReleaseJsonSerializer(jsonSerializer);
|
ReleaseJsonSerializer(jsonSerializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Json
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The order -999 ensures that this provider is executed right after the <c>Microsoft.AspNetCore.Mvc.ApiExplorer.DefaultApiDescriptionProvider</c>.
|
/// The order -999 ensures that this provider is executed right after the <c>Microsoft.AspNetCore.Mvc.ApiExplorer.DefaultApiDescriptionProvider</c>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public int Order
|
public int Order => -999;
|
||||||
{
|
|
||||||
get { return -999; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void OnProvidersExecuting(ApiDescriptionProviderContext context)
|
public void OnProvidersExecuting(ApiDescriptionProviderContext context)
|
||||||
|
|
|
||||||
|
|
@ -53,13 +53,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
object IEnumerator.Current
|
object IEnumerator.Current => Current;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Current;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
|
||||||
public class SerializableErrorWrapperProvider : IWrapperProvider
|
public class SerializableErrorWrapperProvider : IWrapperProvider
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Type WrappingType
|
public Type WrappingType => typeof(SerializableErrorWrapper);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return typeof(SerializableErrorWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public object Wrap(object original)
|
public object Wrap(object original)
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XmlDataContractSerializerInputFormatter : TextInputFormatter
|
public class XmlDataContractSerializerInputFormatter : TextInputFormatter
|
||||||
{
|
{
|
||||||
private DataContractSerializerSettings _serializerSettings;
|
private readonly ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
||||||
private ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
|
||||||
private readonly XmlDictionaryReaderQuotas _readerQuotas = FormattingUtilities.GetDefaultXmlReaderQuotas();
|
private readonly XmlDictionaryReaderQuotas _readerQuotas = FormattingUtilities.GetDefaultXmlReaderQuotas();
|
||||||
private readonly bool _suppressInputFormatterBuffering;
|
private readonly bool _suppressInputFormatterBuffering;
|
||||||
|
private DataContractSerializerSettings _serializerSettings;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of DataContractSerializerInputFormatter
|
/// Initializes a new instance of DataContractSerializerInputFormatter
|
||||||
|
|
@ -78,10 +78,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// The quotas include - DefaultMaxDepth, DefaultMaxStringContentLength, DefaultMaxArrayLength,
|
/// The quotas include - DefaultMaxDepth, DefaultMaxStringContentLength, DefaultMaxArrayLength,
|
||||||
/// DefaultMaxBytesPerRead, DefaultMaxNameTableCharCount
|
/// DefaultMaxBytesPerRead, DefaultMaxNameTableCharCount
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public XmlDictionaryReaderQuotas XmlDictionaryReaderQuotas
|
public XmlDictionaryReaderQuotas XmlDictionaryReaderQuotas => _readerQuotas;
|
||||||
{
|
|
||||||
get { return _readerQuotas; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the <see cref="DataContractSerializerSettings"/> used to configure the
|
/// Gets or sets the <see cref="DataContractSerializerSettings"/> used to configure the
|
||||||
|
|
@ -89,7 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataContractSerializerSettings SerializerSettings
|
public DataContractSerializerSettings SerializerSettings
|
||||||
{
|
{
|
||||||
get { return _serializerSettings; }
|
get => _serializerSettings;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
@ -137,8 +134,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
// Unwrap only if the original type was wrapped.
|
// Unwrap only if the original type was wrapped.
|
||||||
if (type != context.ModelType)
|
if (type != context.ModelType)
|
||||||
{
|
{
|
||||||
var unwrappable = deserializedObject as IUnwrappable;
|
if (deserializedObject is IUnwrappable unwrappable)
|
||||||
if (unwrappable != null)
|
|
||||||
{
|
{
|
||||||
deserializedObject = unwrappable.Unwrap(declaredType: context.ModelType);
|
deserializedObject = unwrappable.Unwrap(declaredType: context.ModelType);
|
||||||
}
|
}
|
||||||
|
|
@ -234,8 +230,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
throw new ArgumentNullException(nameof(type));
|
throw new ArgumentNullException(nameof(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
object serializer;
|
if (!_serializerCache.TryGetValue(type, out var serializer))
|
||||||
if (!_serializerCache.TryGetValue(type, out serializer))
|
|
||||||
{
|
{
|
||||||
serializer = CreateSerializer(type);
|
serializer = CreateSerializer(type);
|
||||||
if (serializer != null)
|
if (serializer != null)
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XmlDataContractSerializerOutputFormatter : TextOutputFormatter
|
public class XmlDataContractSerializerOutputFormatter : TextOutputFormatter
|
||||||
{
|
{
|
||||||
|
private readonly ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
||||||
private DataContractSerializerSettings _serializerSettings;
|
private DataContractSerializerSettings _serializerSettings;
|
||||||
private ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of <see cref="XmlDataContractSerializerOutputFormatter"/>
|
/// Initializes a new instance of <see cref="XmlDataContractSerializerOutputFormatter"/>
|
||||||
|
|
@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DataContractSerializerSettings SerializerSettings
|
public DataContractSerializerSettings SerializerSettings
|
||||||
{
|
{
|
||||||
get { return _serializerSettings; }
|
get => _serializerSettings;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
@ -225,8 +225,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// <returns>The <see cref="DataContractSerializer"/> instance.</returns>
|
/// <returns>The <see cref="DataContractSerializer"/> instance.</returns>
|
||||||
protected virtual DataContractSerializer GetCachedSerializer(Type type)
|
protected virtual DataContractSerializer GetCachedSerializer(Type type)
|
||||||
{
|
{
|
||||||
object serializer;
|
if (!_serializerCache.TryGetValue(type, out var serializer))
|
||||||
if (!_serializerCache.TryGetValue(type, out serializer))
|
|
||||||
{
|
{
|
||||||
serializer = CreateSerializer(type);
|
serializer = CreateSerializer(type);
|
||||||
if (serializer != null)
|
if (serializer != null)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XmlSerializerInputFormatter : TextInputFormatter
|
public class XmlSerializerInputFormatter : TextInputFormatter
|
||||||
{
|
{
|
||||||
private ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
private readonly ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
||||||
private readonly XmlDictionaryReaderQuotas _readerQuotas = FormattingUtilities.GetDefaultXmlReaderQuotas();
|
private readonly XmlDictionaryReaderQuotas _readerQuotas = FormattingUtilities.GetDefaultXmlReaderQuotas();
|
||||||
private readonly bool _suppressInputFormatterBuffering;
|
private readonly bool _suppressInputFormatterBuffering;
|
||||||
|
|
||||||
|
|
@ -75,10 +75,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// The quotas include - DefaultMaxDepth, DefaultMaxStringContentLength, DefaultMaxArrayLength,
|
/// The quotas include - DefaultMaxDepth, DefaultMaxStringContentLength, DefaultMaxArrayLength,
|
||||||
/// DefaultMaxBytesPerRead, DefaultMaxNameTableCharCount
|
/// DefaultMaxBytesPerRead, DefaultMaxNameTableCharCount
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public XmlDictionaryReaderQuotas XmlDictionaryReaderQuotas
|
public XmlDictionaryReaderQuotas XmlDictionaryReaderQuotas => _readerQuotas;
|
||||||
{
|
|
||||||
get { return _readerQuotas; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override async Task<InputFormatterResult> ReadRequestBodyAsync(
|
public override async Task<InputFormatterResult> ReadRequestBodyAsync(
|
||||||
|
|
@ -119,8 +116,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
// Unwrap only if the original type was wrapped.
|
// Unwrap only if the original type was wrapped.
|
||||||
if (type != context.ModelType)
|
if (type != context.ModelType)
|
||||||
{
|
{
|
||||||
var unwrappable = deserializedObject as IUnwrappable;
|
if (deserializedObject is IUnwrappable unwrappable)
|
||||||
if (unwrappable != null)
|
|
||||||
{
|
{
|
||||||
deserializedObject = unwrappable.Unwrap(declaredType: context.ModelType);
|
deserializedObject = unwrappable.Unwrap(declaredType: context.ModelType);
|
||||||
}
|
}
|
||||||
|
|
@ -210,8 +206,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
throw new ArgumentNullException(nameof(type));
|
throw new ArgumentNullException(nameof(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
object serializer;
|
if (!_serializerCache.TryGetValue(type, out var serializer))
|
||||||
if (!_serializerCache.TryGetValue(type, out serializer))
|
|
||||||
{
|
{
|
||||||
serializer = CreateSerializer(type);
|
serializer = CreateSerializer(type);
|
||||||
if (serializer != null)
|
if (serializer != null)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class XmlSerializerOutputFormatter : TextOutputFormatter
|
public class XmlSerializerOutputFormatter : TextOutputFormatter
|
||||||
{
|
{
|
||||||
private ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
private readonly ConcurrentDictionary<Type, object> _serializerCache = new ConcurrentDictionary<Type, object>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of <see cref="XmlSerializerOutputFormatter"/>
|
/// Initializes a new instance of <see cref="XmlSerializerOutputFormatter"/>
|
||||||
|
|
@ -203,8 +203,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// <returns>The <see cref="XmlSerializer"/> instance.</returns>
|
/// <returns>The <see cref="XmlSerializer"/> instance.</returns>
|
||||||
protected virtual XmlSerializer GetCachedSerializer(Type type)
|
protected virtual XmlSerializer GetCachedSerializer(Type type)
|
||||||
{
|
{
|
||||||
object serializer;
|
if (!_serializerCache.TryGetValue(type, out var serializer))
|
||||||
if (!_serializerCache.TryGetValue(type, out serializer))
|
|
||||||
{
|
{
|
||||||
serializer = CreateSerializer(type);
|
serializer = CreateSerializer(type);
|
||||||
if (serializer != null)
|
if (serializer != null)
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the asynchronous delegate to invoke when <see cref="WriteTo(TextWriter, HtmlEncoder)"/> is called.
|
/// Gets the asynchronous delegate to invoke when <see cref="WriteTo(TextWriter, HtmlEncoder)"/> is called.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<TextWriter, Task> WriteAction
|
public Func<TextWriter, Task> WriteAction => _asyncAction;
|
||||||
{
|
|
||||||
get { return _asyncAction; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Method invoked to produce content from the <see cref="HelperResult"/>.
|
/// Method invoked to produce content from the <see cref="HelperResult"/>.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
|
||||||
private readonly Action<RoslynCompilationContext> _compilationCallback;
|
private readonly Action<RoslynCompilationContext> _compilationCallback;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly CSharpCompiler _csharpCompiler;
|
private readonly CSharpCompiler _csharpCompiler;
|
||||||
private IMemoryCache _cache;
|
private readonly IMemoryCache _cache;
|
||||||
|
|
||||||
public RazorViewCompiler(
|
public RazorViewCompiler(
|
||||||
IFileProvider fileProvider,
|
IFileProvider fileProvider,
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue