Make types in Microsoft.AspNetCore.Mvc.Internal namespace internal

This commit is contained in:
Pranav K 2018-10-24 12:44:11 -07:00
parent 9f1a222d90
commit 8d66f104f7
335 changed files with 483 additions and 750 deletions

View File

@ -5,10 +5,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Routing.Template;

View File

@ -7,12 +7,11 @@ using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.Infrastructure;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
public class ActionConstraintCache
internal class ActionConstraintCache
{
private readonly IActionDescriptorCollectionProvider _collectionProvider;
private readonly IActionConstraintProvider[] _actionConstraintProviders;

View File

@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
/// <summary>
/// A default implementation of <see cref="IActionConstraintProvider"/>.
@ -14,7 +13,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <see cref="IActionConstraintMetadata"/> implements <see cref="IActionConstraint"/> or
/// <see cref="IActionConstraintFactory"/>/
/// </remarks>
public class DefaultActionConstraintProvider : IActionConstraintProvider
internal class DefaultActionConstraintProvider : IActionConstraintProvider
{
/// <inheritdoc />
public int Order => -1000;
@ -61,4 +60,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -4,12 +4,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
public class HttpMethodActionConstraint : IActionConstraint
internal class HttpMethodActionConstraint : IActionConstraint
{
public static readonly int HttpMethodConstraintOrder = 100;

View File

@ -1,15 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.ActionConstraints;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ActionConstraints
{
/// <summary>
/// An <see cref="IActionConstraint"/> constraint that identifies a type which can be used to select an action
/// based on incoming request.
/// </summary>
public interface IConsumesActionConstraint : IActionConstraint
internal interface IConsumesActionConstraint : IActionConstraint
{
}
}
}

View File

@ -1,13 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc
{
/// <summary>
/// Represents data used to build an <c>ApiDescription</c>, stored as part of the
/// <see cref="Abstractions.ActionDescriptor.Properties"/>.
/// </summary>
public class ApiDescriptionActionData
internal class ApiDescriptionActionData
{
/// <summary>
/// The <c>ApiDescription.GroupName</c> of <c>ApiDescription</c> objects for the associated
@ -15,4 +15,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
public string GroupName { get; set; }
}
}
}

View File

@ -3,11 +3,10 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public static class ActionAttributeRouteModel
internal static class ActionAttributeRouteModel
{
public static IEnumerable<(AttributeRouteModel route, SelectorModel actionSelector, SelectorModel controllerSelector)> GetAttributeRoutes(ActionModel actionModel)
{

View File

@ -7,7 +7,6 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

View File

@ -4,14 +4,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
/// <summary>
/// Applies conventions to a <see cref="ApplicationModel"/>.
/// </summary>
public static class ApplicationModelConventions
internal static class ApplicationModelConventions
{
/// <summary>
/// Applies conventions to a <see cref="ApplicationModel"/>.

View File

@ -5,12 +5,11 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Authorization;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class AuthorizationApplicationModelProvider : IApplicationModelProvider
internal class AuthorizationApplicationModelProvider : IApplicationModelProvider
{
private readonly IAuthorizationPolicyProvider _policyProvider;

View File

@ -3,7 +3,7 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Microsoft.AspNetCore.Mvc.ApplicationModels

View File

@ -8,19 +8,18 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
/// <summary>
/// Creates instances of <see cref="ControllerActionDescriptor"/> from <see cref="ApplicationModel"/>.
/// </summary>
public static class ControllerActionDescriptorBuilder
internal static class ControllerActionDescriptorBuilder
{
// This is the default order for attribute routes whose order calculated from
// the controller model is null.
@ -634,4 +633,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -6,14 +6,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class ControllerActionDescriptorProvider : IActionDescriptorProvider
internal class ControllerActionDescriptorProvider : IActionDescriptorProvider
{
private readonly ApplicationPartManager _partManager;
private readonly IApplicationModelProvider[] _applicationModelProviders;
@ -63,7 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <inheritdoc />
public void OnProvidersExecuted(ActionDescriptorProviderContext context)
{
// After all of the providers have run, we need to provide a 'null' for each all of route values that
// After all of the providers have run, we need to provide a 'null' for each all of route values that
// participate in action selection.
//
// This is important for scenarios like Razor Pages, that use the 'page' route value. An action that
@ -95,14 +94,14 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
protected internal IEnumerable<ControllerActionDescriptor> GetDescriptors()
internal IEnumerable<ControllerActionDescriptor> GetDescriptors()
{
var applicationModel = BuildModel();
ApplicationModelConventions.ApplyConventions(applicationModel, _conventions);
return ControllerActionDescriptorBuilder.Build(applicationModel);
}
protected internal ApplicationModel BuildModel()
internal ApplicationModel BuildModel()
{
var controllerTypes = GetControllerTypes();
var context = new ApplicationModelProviderContext(controllerTypes);

View File

@ -7,7 +7,6 @@ using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.Routing;
@ -15,9 +14,9 @@ using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
{
public class DefaultApplicationModelProvider : IApplicationModelProvider
internal class DefaultApplicationModelProvider : IApplicationModelProvider
{
private readonly MvcOptions _mvcOptions;
private readonly IModelMetadataProvider _modelMetadataProvider;
@ -39,7 +38,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
public int Order => -1000;
/// <inheritdoc />
public virtual void OnProvidersExecuting(ApplicationModelProviderContext context)
public void OnProvidersExecuting(ApplicationModelProviderContext context)
{
if (context == null)
{
@ -98,7 +97,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
/// <inheritdoc />
public virtual void OnProvidersExecuted(ApplicationModelProviderContext context)
public void OnProvidersExecuted(ApplicationModelProviderContext context)
{
// Intentionally empty.
}
@ -108,7 +107,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
/// <param name="typeInfo">The <see cref="TypeInfo"/>.</param>
/// <returns>A <see cref="ControllerModel"/> for the given <see cref="TypeInfo"/>.</returns>
protected virtual ControllerModel CreateControllerModel(TypeInfo typeInfo)
internal ControllerModel CreateControllerModel(TypeInfo typeInfo)
{
if (typeInfo == null)
{
@ -215,7 +214,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
/// <param name="propertyInfo">The <see cref="PropertyInfo"/>.</param>
/// <returns>A <see cref="PropertyModel"/> for the given <see cref="PropertyInfo"/>.</returns>
protected virtual PropertyModel CreatePropertyModel(PropertyInfo propertyInfo)
internal PropertyModel CreatePropertyModel(PropertyInfo propertyInfo)
{
if (propertyInfo == null)
{
@ -263,7 +262,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// An <see cref="ActionModel"/> instance for the given action <see cref="MethodInfo"/> or
/// <c>null</c> if the <paramref name="methodInfo"/> does not represent an action.
/// </returns>
protected virtual ActionModel CreateActionModel(
internal ActionModel CreateActionModel(
TypeInfo typeInfo,
MethodInfo methodInfo)
{
@ -381,7 +380,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <remarks>
/// Override this method to provide custom logic to determine which methods are considered actions.
/// </remarks>
protected virtual bool IsAction(TypeInfo typeInfo, MethodInfo methodInfo)
internal bool IsAction(TypeInfo typeInfo, MethodInfo methodInfo)
{
if (typeInfo == null)
{
@ -445,7 +444,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
/// <param name="parameterInfo">The <see cref="ParameterInfo"/>.</param>
/// <returns>A <see cref="ParameterModel"/> for the given <see cref="ParameterInfo"/>.</returns>
protected virtual ParameterModel CreateParameterModel(ParameterInfo parameterInfo)
internal ParameterModel CreateParameterModel(ParameterInfo parameterInfo)
{
if (parameterInfo == null)
{

View File

@ -3,7 +3,6 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Routing.Template;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;

View File

@ -8,9 +8,9 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization.Policy;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

View File

@ -4,10 +4,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

View File

@ -1,14 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

View File

@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Net.Http.Headers;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;

View File

@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc

View File

@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;

View File

@ -4,9 +4,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
public delegate Task ControllerBinderDelegate(
internal delegate Task ControllerBinderDelegate(
ControllerContext controllerContext,
object controller,
Dictionary<string, object> arguments);

View File

@ -7,10 +7,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
// Note: changes made to binding behavior in type should also be made to PageBinderFactory.
public static class ControllerBinderDelegateProvider
internal static class ControllerBinderDelegateProvider
{
public static ControllerBinderDelegate CreateBinderDelegate(
ParameterBinder parameterBinder,

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.Controllers
{
@ -19,10 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
public ControllerFactoryProvider(
IControllerActivatorProvider activatorProvider,
IControllerFactory controllerFactory,
#pragma warning disable PUB0001 // Pubternal type in public API
IEnumerable<IControllerPropertyActivator> propertyActivators
#pragma warning restore PUB0001
)
IEnumerable<IControllerPropertyActivator> propertyActivators)
{
if (activatorProvider == null)
{

View File

@ -3,7 +3,7 @@
using System;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Infrastructure;
namespace Microsoft.AspNetCore.Mvc.Controllers
{
@ -18,9 +18,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
/// Creates a new <see cref="DefaultControllerActivator"/>.
/// </summary>
/// <param name="typeActivatorCache">The <see cref="ITypeActivatorCache"/>.</param>
#pragma warning disable PUB0001 // Pubternal type in public API
public DefaultControllerActivator(ITypeActivatorCache typeActivatorCache)
#pragma warning restore PUB0001
{
if (typeActivatorCache == null)
{
@ -71,8 +69,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
throw new ArgumentNullException(nameof(controller));
}
var disposable = controller as IDisposable;
if (disposable != null)
if (controller is IDisposable disposable)
{
disposable.Dispose();
}

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.Controllers
{
@ -29,10 +28,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
/// </param>
public DefaultControllerFactory(
IControllerActivator controllerActivator,
#pragma warning disable PUB0001 // Pubternal type in public API
IEnumerable<IControllerPropertyActivator> propertyActivators
#pragma warning restore PUB0001
)
IEnumerable<IControllerPropertyActivator> propertyActivators)
{
if (controllerActivator == null)
{

View File

@ -6,13 +6,12 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
public class DefaultControllerPropertyActivator : IControllerPropertyActivator
internal class DefaultControllerPropertyActivator : IControllerPropertyActivator
{
private static readonly Func<Type, PropertyActivator<ControllerContext>[]> _getPropertiesToActivate =
GetPropertiesToActivate;

View File

@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.Controllers;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Controllers
{
public interface IControllerPropertyActivator
{

View File

@ -4,14 +4,15 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
public class ApiBehaviorOptionsSetup :
internal class ApiBehaviorOptionsSetup :
ConfigureCompatibilityOptions<ApiBehaviorOptions>,
IConfigureOptions<ApiBehaviorOptions>
{

View File

@ -3,14 +3,13 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Allows fine grained configuration of MVC services.
/// </summary>
public class MvcBuilder : IMvcBuilder
internal class MvcBuilder : IMvcBuilder
{
/// <summary>
/// Initializes a new <see cref="MvcBuilder"/> instance.
@ -39,4 +38,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <inheritdoc />
public ApplicationPartManager PartManager { get; }
}
}
}

View File

@ -3,14 +3,13 @@
using System;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Allows fine grained configuration of essential MVC services.
/// </summary>
public class MvcCoreBuilder : IMvcCoreBuilder
internal class MvcCoreBuilder : IMvcCoreBuilder
{
/// <summary>
/// Initializes a new <see cref="MvcCoreBuilder"/> instance.
@ -41,4 +40,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <inheritdoc />
public IServiceCollection Services { get; }
}
}
}

View File

@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.DependencyInjection

View File

@ -6,12 +6,12 @@ using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Sets up MVC default options for <see cref="RouteOptions"/>.
/// </summary>
public class MvcCoreRouteOptionsSetup : IConfigureOptions<RouteOptions>
internal class MvcCoreRouteOptionsSetup : IConfigureOptions<RouteOptions>
{
/// <summary>
/// Configures the <see cref="RouteOptions"/>.

View File

@ -13,7 +13,6 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;

View File

@ -1,15 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// A marker class used to determine if all the MVC services were added
/// to the <see cref="IServiceCollection"/> before MVC is configured.
/// </summary>
public class MvcMarkerService
internal class MvcMarkerService
{
}
}
}

View File

@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc

View File

@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Net.Http.Headers;

View File

@ -5,7 +5,6 @@ using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Net.Http.Headers;

View File

@ -4,14 +4,13 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter implementation which delegates to the controller for action filter interfaces.
/// </summary>
public class ControllerActionFilter : IAsyncActionFilter, IOrderedFilter
internal class ControllerActionFilter : IAsyncActionFilter, IOrderedFilter
{
// Controller-filter methods run farthest from the action by default.
/// <inheritdoc />
@ -55,7 +54,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
private static async Task ExecuteActionFilter(
ActionExecutingContext context,
ActionExecutingContext context,
ActionExecutionDelegate next,
IActionFilter actionFilter)
{
@ -66,4 +65,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -4,14 +4,13 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter implementation which delegates to the controller for result filter interfaces.
/// </summary>
public class ControllerResultFilter : IAsyncResultFilter, IOrderedFilter
internal class ControllerResultFilter : IAsyncResultFilter, IOrderedFilter
{
// Controller-filter methods run farthest from the result by default.
/// <inheritdoc />
@ -66,4 +65,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -4,11 +4,10 @@
using System;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public class DefaultFilterProvider : IFilterProvider
internal class DefaultFilterProvider : IFilterProvider
{
public int Order => -1000;
@ -35,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
}
public virtual void ProvideFilter(FilterProviderContext context, FilterItem filterItem)
public void ProvideFilter(FilterProviderContext context, FilterItem filterItem)
{
if (filterItem.Filter != null)
{
@ -44,8 +43,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
var filter = filterItem.Descriptor.Filter;
var filterFactory = filter as IFilterFactory;
if (filterFactory == null)
if (!(filter is IFilterFactory filterFactory))
{
filterItem.Filter = filter;
filterItem.IsReusable = true;
@ -72,9 +70,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
Debug.Assert(actualFilter != null, "actualFilter should not be null");
Debug.Assert(filterMetadata != null, "filterMetadata should not be null");
var container = actualFilter as IFilterContainer;
if (container != null)
if (actualFilter is IFilterContainer container)
{
container.FilterDefinition = filterMetadata;
}

View File

@ -3,16 +3,15 @@
using System;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter that sets <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/>
/// to <c>null</c>.
/// </summary>
public class DisableRequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
internal class DisableRequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
{
private readonly ILogger _logger;
@ -29,8 +28,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// to <c>null</c>.
/// </summary>
/// <param name="context">The <see cref="AuthorizationFilterContext"/>.</param>
/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only,
/// the <see cref="DisableRequestSizeLimitAttribute"/> is not applied.</remarks>
/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only,
/// the <see cref="DisableRequestSizeLimitAttribute"/> is not applied.</remarks>
public void OnAuthorization(AuthorizationFilterContext context)
{
if (context == null)

View File

@ -1,9 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A one-way cursor for filters.
@ -25,7 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// Result
///
/// </remarks>
public struct FilterCursor
internal struct FilterCursor
{
private readonly IFilterMetadata[] _filters;
private int _index;

View File

@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public readonly struct FilterCursorItem<TFilter, TFilterAsync>
internal readonly struct FilterCursorItem<TFilter, TFilterAsync>
{
public FilterCursorItem(TFilter filter, TFilterAsync filterAsync)
{

View File

@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public class FilterDescriptorOrderComparer : IComparer<FilterDescriptor>
internal class FilterDescriptorOrderComparer : IComparer<FilterDescriptor>
{
public static FilterDescriptorOrderComparer Comparer { get; } = new FilterDescriptorOrderComparer();

View File

@ -4,11 +4,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public static class FilterFactory
internal static class FilterFactory
{
public static FilterFactoryResult GetAllFilters(
IFilterProvider[] filterProviders,

View File

@ -1,11 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public readonly struct FilterFactoryResult
internal readonly struct FilterFactoryResult
{
public FilterFactoryResult(
FilterItem[] cacheableFilters,

View File

@ -1,19 +1,17 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A feature in <see cref="Microsoft.AspNetCore.Http.HttpContext.Features"/> which is used to capture the
/// currently executing context of a resource filter. This feature is used in the final middleware
/// of a middleware filter's pipeline to keep the request flow through the rest of the MVC layers.
/// </summary>
public interface IMiddlewareFilterFeature
internal interface IMiddlewareFilterFeature
{
ResourceExecutingContext ResourceExecutingContext { get; }
ResourceExecutionDelegate ResourceExecutionDelegate { get; }
}
}
}

View File

@ -1,14 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter which sets the appropriate headers related to Response caching.
/// </summary>
public interface IResponseCacheFilter : IFilterMetadata
internal interface IResponseCacheFilter : IFilterMetadata
{
}
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter which executes a user configured middleware pipeline.

View File

@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc

View File

@ -7,12 +7,12 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// Builds a middleware pipeline after receiving the pipeline from a pipeline provider
/// </summary>
public class MiddlewareFilterBuilder
internal class MiddlewareFilterBuilder
{
// 'GetOrAdd' call on the dictionary is not thread safe and we might end up creating the pipeline more
// once. To prevent this Lazy<> is used. In the worst case multiple Lazy<> objects are created for multiple

View File

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
internal class MiddlewareFilterBuilderStartupFilter : IStartupFilter
{
@ -23,4 +23,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
}
}
}
}
}

View File

@ -8,13 +8,13 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// Calls into user provided 'Configure' methods for configuring a middleware pipeline. The semantics of finding
/// the 'Configure' methods is similar to the application Startup class.
/// </summary>
public class MiddlewareFilterConfigurationProvider
internal class MiddlewareFilterConfigurationProvider
{
public Action<IApplicationBuilder> CreateConfigureDelegate(Type configurationType)
{

View File

@ -1,11 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public class MiddlewareFilterFeature : IMiddlewareFilterFeature
internal class MiddlewareFilterFeature : IMiddlewareFilterFeature
{
public ResourceExecutingContext ResourceExecutingContext { get; set; }

View File

@ -3,15 +3,14 @@
using System;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter that configures <see cref="FormOptions"/> for the current request.
/// </summary>
public class RequestFormLimitsFilter : IAuthorizationFilter, IRequestFormLimitsPolicy
internal class RequestFormLimitsFilter : IAuthorizationFilter, IRequestFormLimitsPolicy
{
private readonly ILogger _logger;

View File

@ -3,16 +3,15 @@
using System;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// A filter that sets the <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/>
/// A filter that sets the <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/>
/// to the specified <see cref="Bytes"/>.
/// </summary>
public class RequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
internal class RequestSizeLimitFilter : IAuthorizationFilter, IRequestSizePolicy
{
private readonly ILogger _logger;
@ -30,7 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// Sets the <see cref="IHttpMaxRequestBodySizeFeature.MaxRequestBodySize"/> to <see cref="Bytes"/>.
/// </summary>
/// <param name="context">The <see cref="AuthorizationFilterContext"/>.</param>
/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only,
/// <remarks>If <see cref="IHttpMaxRequestBodySizeFeature"/> is not enabled or is read-only,
/// the <see cref="RequestSizeLimitAttribute"/> is not applied.</remarks>
public void OnAuthorization(AuthorizationFilterContext context)
{

View File

@ -2,15 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
/// <summary>
/// An <see cref="IActionFilter"/> which sets the appropriate headers related to response caching.
/// </summary>
public class ResponseCacheFilter : IActionFilter, IResponseCacheFilter
internal class ResponseCacheFilter : IActionFilter, IResponseCacheFilter
{
private readonly ResponseCacheFilterExecutor _executor;
private readonly ILogger _logger;
@ -105,4 +104,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
{
}
}
}
}

View File

@ -2,16 +2,14 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.ResponseCaching;
using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Filters
{
public class ResponseCacheFilterExecutor
internal class ResponseCacheFilterExecutor
{
private readonly CacheProfile _cacheProfile;
private int? _cacheDuration;

View File

@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

View File

@ -5,9 +5,9 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
namespace Microsoft.AspNetCore.Mvc.Formatters
{
public static class AcceptHeaderParser
internal static class AcceptHeaderParser
{
public static IList<MediaTypeSegmentWithQuality> ParseAcceptHeader(IList<string> acceptHeaders)
{
@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
}
// We deliberately want to ignore media types that we are not capable of parsing.
// This is due to the fact that some browsers will send invalid media types like
// This is due to the fact that some browsers will send invalid media types like
// ; q=0.9 or */;q=0.2, etc.
// In this scenario, our recovery action consists of advancing the pointer to the
// next separator and moving on.

View File

@ -6,8 +6,6 @@ using System.Globalization;
using System.Linq;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Formatters.Internal;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;

View File

@ -1,9 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
namespace Microsoft.AspNetCore.Mvc.Formatters
{
public enum HttpParseResult
internal enum HttpParseResult
{
Parsed,
NotParsed,

View File

@ -4,9 +4,9 @@
using System.Diagnostics.Contracts;
using System.Text;
namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
namespace Microsoft.AspNetCore.Mvc.Formatters
{
public static class HttpTokenParsingRules
internal static class HttpTokenParsingRules
{
private static readonly bool[] TokenChars;
private const int MaxNestedCount = 5;

View File

@ -3,12 +3,12 @@
using Microsoft.AspNetCore.Mvc.Filters;
namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
namespace Microsoft.AspNetCore.Mvc.Formatters
{
/// <summary>
/// A filter that produces the desired content type for the request.
/// </summary>
public interface IFormatFilter : IFilterMetadata
internal interface IFormatFilter : IFilterMetadata
{
/// <summary>
/// Gets the format value for the request associated with the provided <see cref="ActionContext"/>.
@ -17,4 +17,4 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
/// <returns>A format value, or <c>null</c> if a format cannot be determined for the request.</returns>
string GetFormat(ActionContext context);
}
}
}

View File

@ -5,7 +5,6 @@ using System;
using System.Globalization;
using System.Text;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Formatters.Internal;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Mvc.Formatters
@ -393,9 +392,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
/// <param name="mediaType">The media type to parse.</param>
/// <param name="start">The position at which the parsing starts.</param>
/// <returns>The parsed media type with its associated quality.</returns>
#pragma warning disable PUB0001 // Pubternal type in public API
public static MediaTypeSegmentWithQuality CreateMediaTypeSegmentWithQuality(string mediaType, int start)
#pragma warning restore PUB0001
{
var parsedMediaType = new MediaType(mediaType, start, length: null);

View File

@ -3,7 +3,7 @@
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Mvc.Formatters.Internal
namespace Microsoft.AspNetCore.Mvc.Formatters
{
/// <summary>
/// A media type with its associated quality.

View File

@ -4,11 +4,10 @@
using System.Diagnostics;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Formatters
{
public static class ResponseContentTypeHelper
internal static class ResponseContentTypeHelper
{
/// <summary>
/// Gets the content type and encoding that need to be used for the response.

View File

@ -4,11 +4,10 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Infrastructure;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ActionInvokerFactory : IActionInvokerFactory
internal class ActionInvokerFactory : IActionInvokerFactory
{
private readonly IActionInvokerProvider[] _actionInvokerProviders;

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
internal abstract class ActionMethodExecutor
{

View File

@ -2,11 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.Infrastructure;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ActionResultTypeMapper : IActionResultTypeMapper
internal class ActionResultTypeMapper : IActionResultTypeMapper
{
public Type GetResultDataType(Type returnType)
{
@ -15,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
throw new ArgumentNullException(nameof(returnType));
}
if (returnType.IsGenericType &&
if (returnType.IsGenericType &&
returnType.GetGenericTypeDefinition() == typeof(ActionResult<>))
{
return returnType.GetGenericArguments()[0];

View File

@ -15,12 +15,12 @@ using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// A default <see cref="IActionSelector"/> implementation.
/// </summary>
public class ActionSelector : IActionSelector
internal class ActionSelector : IActionSelector
{
private static readonly IReadOnlyList<ActionDescriptor> EmptyActions = Array.Empty<ActionDescriptor>();
@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// </summary>
/// <param name="actions">The set of actions that satisfy all constraints.</param>
/// <returns>A list of the best matching actions.</returns>
protected virtual IReadOnlyList<ActionDescriptor> SelectBestActions(IReadOnlyList<ActionDescriptor> actions)
private IReadOnlyList<ActionDescriptor> SelectBestActions(IReadOnlyList<ActionDescriptor> actions)
{
return actions;
}

View File

@ -4,13 +4,13 @@
using System;
using System.Runtime.Serialization;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// An exception which indicates multiple matches in action selection.
/// </summary>
[Serializable]
public class AmbiguousActionException : InvalidOperationException
internal class AmbiguousActionException : InvalidOperationException
{
public AmbiguousActionException(string message)
: base(message)

View File

@ -3,7 +3,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure

View File

@ -2,9 +2,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
@ -36,14 +35,12 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
var response = context.HttpContext.Response;
string resolvedContentType;
Encoding resolvedContentTypeEncoding;
ResponseContentTypeHelper.ResolveContentTypeAndEncoding(
result.ContentType,
response.ContentType,
DefaultContentType,
out resolvedContentType,
out resolvedContentTypeEncoding);
out var resolvedContentType,
out var resolvedContentTypeEncoding);
response.ContentType = resolvedContentType;

View File

@ -8,14 +8,13 @@ using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging;
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ControllerActionInvoker : ResourceInvoker, IActionInvoker
internal class ControllerActionInvoker : ResourceInvoker, IActionInvoker
{
private readonly ControllerActionInvokerCacheEntry _cacheEntry;
private readonly ControllerContext _controllerContext;

View File

@ -12,9 +12,9 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ControllerActionInvokerCache
internal class ControllerActionInvokerCache
{
private readonly IActionDescriptorCollectionProvider _collectionProvider;
private readonly ParameterBinder _parameterBinder;

View File

@ -2,12 +2,13 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ControllerActionInvokerCacheEntry
internal class ControllerActionInvokerCacheEntry
{
internal ControllerActionInvokerCacheEntry(
FilterItem[] cachedFilters,

View File

@ -7,14 +7,13 @@ using System.Diagnostics;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Abstractions;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class ControllerActionInvokerProvider : IActionInvokerProvider
internal class ControllerActionInvokerProvider : IActionInvokerProvider
{
private readonly ControllerActionInvokerCache _controllerActionInvokerCache;
private readonly IReadOnlyList<IValueProviderFactory> _valueProviderFactories;

View File

@ -4,9 +4,9 @@
using System.Collections;
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public class CopyOnWriteList<T> : IList<T>
internal class CopyOnWriteList<T> : IList<T>
{
private readonly IReadOnlyList<T> _source;
private List<T> _copy;
@ -16,9 +16,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
_source = source;
}
protected IReadOnlyList<T> Readable => _copy ?? _source;
private IReadOnlyList<T> Readable => _copy ?? _source;
protected List<T> Writable
private List<T> Writable
{
get
{

View File

@ -7,8 +7,6 @@ using System.Collections.ObjectModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Formatters.Internal;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;

View File

@ -4,7 +4,6 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Http.Headers;
using Microsoft.AspNetCore.Internal;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

View File

@ -3,7 +3,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
/// <param name="context">The <see cref="RouteContext"/> associated with the current request.</param>
/// <param name="candidates">The set of <see cref="ActionDescriptor"/> candidates.</param>
/// <returns>The best <see cref="ActionDescriptor"/> candidate for the current request or <c>null</c>.</returns>
/// <exception cref="Internal.AmbiguousActionException">
/// <exception cref="AmbiguousActionException">
/// Thrown when action selection results in an ambiguity.
/// </exception>
/// <remarks>

View File

@ -3,10 +3,10 @@
using System;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// Caches <see cref="Microsoft.Extensions.DependencyInjection.ObjectFactory"/> instances produced by
/// Caches <see cref="Microsoft.Extensions.DependencyInjection.ObjectFactory"/> instances produced by
/// <see cref="Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateFactory(Type, Type[])"/>.
/// </summary>
public interface ITypeActivatorCache
@ -19,4 +19,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <param name="optionType">The <see cref="Type"/> of the <typeparamref name="TInstance"/> to create.</param>
TInstance CreateInstance<TInstance>(IServiceProvider serviceProvider, Type optionType);
}
}
}

View File

@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

View File

@ -5,15 +5,14 @@ using System;
using System.Buffers;
using System.IO;
using System.Text;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.WebUtilities;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// An <see cref="IHttpRequestStreamReaderFactory"/> that uses pooled buffers.
/// </summary>
public class MemoryPoolHttpRequestStreamReaderFactory : IHttpRequestStreamReaderFactory
internal class MemoryPoolHttpRequestStreamReaderFactory : IHttpRequestStreamReaderFactory
{
/// <summary>
/// The default size of created char buffers.

View File

@ -5,15 +5,14 @@ using System;
using System.Buffers;
using System.IO;
using System.Text;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.WebUtilities;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// An <see cref="IHttpResponseStreamWriterFactory"/> that uses pooled buffers.
/// </summary>
public class MemoryPoolHttpResponseStreamWriterFactory : IHttpResponseStreamWriterFactory
internal class MemoryPoolHttpResponseStreamWriterFactory : IHttpResponseStreamWriterFactory
{
/// <summary>
/// The default size of buffers <see cref="HttpResponseStreamWriter"/>s will allocate.

View File

@ -4,7 +4,6 @@
using System;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure

View File

@ -9,7 +9,7 @@ using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
internal sealed class ModelStateInvalidFilterFactory : IFilterFactory, IOrderedFilter
internal class ModelStateInvalidFilterFactory : IFilterFactory, IOrderedFilter
{
public int Order => ModelStateInvalidFilter.FilterOrder;

View File

@ -8,7 +8,6 @@ using System.Threading;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;

View File

@ -6,14 +6,14 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
/// <summary>
/// Stream that delegates to an inner stream.
/// This Stream is present so that the inner stream is not closed
/// even when Close() or Dispose() is called.
/// </summary>
public class NonDisposableStream : Stream
internal class NonDisposableStream : Stream
{
private readonly Stream _innerStream;
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
/// <summary>
/// The inner stream this object delegates to.
/// </summary>
protected Stream InnerStream => _innerStream;
private Stream InnerStream => _innerStream;
/// <inheritdoc />
public override bool CanRead => _innerStream.CanRead;

View File

@ -9,7 +9,6 @@ using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Mvc.Infrastructure

View File

@ -6,9 +6,9 @@ using System.ComponentModel;
using System.Reflection;
using Microsoft.Extensions.Internal;
namespace Microsoft.AspNetCore.Mvc.Internal
namespace Microsoft.AspNetCore.Mvc.Infrastructure
{
public static class ParameterDefaultValues
internal static class ParameterDefaultValues
{
public static object[] GetParameterDefaultValues(MethodInfo methodInfo)
{

View File

@ -7,7 +7,6 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

View File

@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

View File

@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

View File

@ -5,7 +5,6 @@ using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Core;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;

Some files were not shown because too many files have changed in this diff Show More