Add MVC.Core api docs (#26469)
* Add docs * Add api docs * Add xml doc * Reenable warnings on identity projects * Razor pages docs * Add doc * Missed files * Add docs * Apply suggestions from code review Co-authored-by: Safia Abdalla <safia@microsoft.com> * Apply suggestions from code review Co-authored-by: Safia Abdalla <safia@microsoft.com> * PR feedback * Update src/Mvc/Mvc.Core/src/ConsumesAttribute.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.Core/src/ModelBinding/Validation/ValidationVisitor.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.Core/src/Routing/UrlHelperBase.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.Core/src/ModelBinding/Validation/ValidationVisitor.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.Core/src/Infrastructure/FileResultExecutorBase.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.Core/src/Routing/UrlHelperBase.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update src/Mvc/Mvc.Core/src/Routing/UrlHelperBase.cs Co-authored-by: Pranav K <prkrishn@hotmail.com> * Update ValidationVisitor.cs Co-authored-by: Safia Abdalla <safia@microsoft.com> Co-authored-by: Pranav K <prkrishn@hotmail.com>
This commit is contained in:
parent
0f7e8ec979
commit
5e2259f4bb
|
|
@ -5,6 +5,7 @@
|
||||||
<Description>ASP.NET Core API Authorization package powered by Identity Server.</Description>
|
<Description>ASP.NET Core API Authorization package powered by Identity Server.</Description>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;apiauth;identity</PackageTags>
|
<PackageTags>aspnetcore;apiauth;identity</PackageTags>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
<!-- We are a package that depends on the shared framework, this allows us to
|
<!-- We are a package that depends on the shared framework, this allows us to
|
||||||
avoid errors during restore -->
|
avoid errors during restore -->
|
||||||
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ using IdentityServer4.Models;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer
|
namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A collection of <see cref="ApiScope"/>.
|
||||||
|
/// </summary>
|
||||||
public class ApiScopeCollection : Collection<ApiScope>
|
public class ApiScopeCollection : Collection<ApiScope>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. ASP.NET Core Identity allows you to add login features to your application and makes it easy to customize data about the logged in user.</Description>
|
<Description>ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. ASP.NET Core Identity allows you to add login features to your application and makes it easy to customize data about the logged in user.</Description>
|
||||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||||
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;identity;membership</PackageTags>
|
<PackageTags>aspnetcore;identity;membership</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core Identity provider that uses Entity Framework Core.</Description>
|
<Description>ASP.NET Core Identity provider that uses Entity Framework Core.</Description>
|
||||||
<TargetFrameworks>netstandard2.1;$(DefaultNetCoreTargetFramework)</TargetFrameworks>
|
<TargetFrameworks>netstandard2.1;$(DefaultNetCoreTargetFramework)</TargetFrameworks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;entityframeworkcore;identity;membership</PackageTags>
|
<PackageTags>aspnetcore;entityframeworkcore;identity;membership</PackageTags>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;identity;membership</PackageTags>
|
<PackageTags>aspnetcore;identity;membership</PackageTags>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;identity;membership</PackageTags>
|
<PackageTags>aspnetcore;identity;membership</PackageTags>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
<EnableDefaultRazorGenerateItems>false</EnableDefaultRazorGenerateItems>
|
<EnableDefaultRazorGenerateItems>false</EnableDefaultRazorGenerateItems>
|
||||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
|
|
||||||
<DisableStaticWebAssetsBuildPropsFileGeneration>true</DisableStaticWebAssetsBuildPropsFileGeneration>
|
<DisableStaticWebAssetsBuildPropsFileGeneration>true</DisableStaticWebAssetsBuildPropsFileGeneration>
|
||||||
<StaticWebAssetsDisableProjectBuildPropsFileGeneration>true</StaticWebAssetsDisableProjectBuildPropsFileGeneration>
|
<StaticWebAssetsDisableProjectBuildPropsFileGeneration>true</StaticWebAssetsDisableProjectBuildPropsFileGeneration>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC abstractions and interfaces for action invocation and dispatching, authorization, action filters, formatters, model binding, routing, validation, and more.
|
<Description>ASP.NET Core MVC abstractions and interfaces for action invocation and dispatching, authorization, action filters, formatters, model binding, routing, validation, and more.
|
||||||
|
|
@ -10,6 +10,7 @@ Microsoft.AspNetCore.Mvc.IActionResult</Description>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
_inner = new Dictionary<object, ValidationStateEntry>(ReferenceEqualityComparer.Instance);
|
_inner = new Dictionary<object, ValidationStateEntry>(ReferenceEqualityComparer.Instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public ValidationStateEntry? this[object key]
|
public ValidationStateEntry? this[object key]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -134,4 +135,4 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
return ((IDictionary<object, ValidationStateEntry>)_inner).GetEnumerator();
|
return ((IDictionary<object, ValidationStateEntry>)_inner).GetEnumerator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>CSharp Analyzers for ASP.NET Core MVC.</Description>
|
<Description>CSharp Analyzers for ASP.NET Core MVC.</Description>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
|
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>CSharp Analyzers for ASP.NET Core MVC.</Description>
|
<Description>CSharp Analyzers for ASP.NET Core MVC.</Description>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
|
<NuspecFile>$(MSBuildProjectName).nuspec</NuspecFile>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC API explorer functionality for discovering metadata such as the list of controllers and actions, and their URLs and allowed HTTP methods.</Description>
|
<Description>ASP.NET Core MVC API explorer functionality for discovering metadata such as the list of controllers and actions, and their URLs and allowed HTTP methods.</Description>
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -249,11 +249,24 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
return result.Substring(startIndex, subStringLength);
|
return result.Substring(startIndex, subStringLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces the tokens in the template with the provided values.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="template">The template.</param>
|
||||||
|
/// <param name="values">The token values to use.</param>
|
||||||
|
/// <returns>A new string with the replaced values.</returns>
|
||||||
public static string ReplaceTokens(string template, IDictionary<string, string> values)
|
public static string ReplaceTokens(string template, IDictionary<string, string> values)
|
||||||
{
|
{
|
||||||
return ReplaceTokens(template, values, routeTokenTransformer: null);
|
return ReplaceTokens(template, values, routeTokenTransformer: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces the tokens in the template with the provided values and route token transformer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="template">The template.</param>
|
||||||
|
/// <param name="values">The token values to use.</param>
|
||||||
|
/// <param name="routeTokenTransformer">The route token transformer.</param>
|
||||||
|
/// <returns>A new string with the replaced values.</returns>
|
||||||
public static string ReplaceTokens(string template, IDictionary<string, string> values, IOutboundParameterTransformer routeTokenTransformer)
|
public static string ReplaceTokens(string template, IDictionary<string, string> values, IOutboundParameterTransformer routeTokenTransformer)
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
|
@ -464,4 +477,4 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
SeenRight = 4,
|
SeenRight = 4,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,17 @@ using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A model for configuring controllers.
|
||||||
|
/// </summary>
|
||||||
[DebuggerDisplay("{DisplayName}")]
|
[DebuggerDisplay("{DisplayName}")]
|
||||||
public class ControllerModel : ICommonModel, IFilterModel, IApiExplorerModel
|
public class ControllerModel : ICommonModel, IFilterModel, IApiExplorerModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="ControllerModel"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="controllerType">The type of the controller.</param>
|
||||||
|
/// <param name="attributes">The attributes.</param>
|
||||||
public ControllerModel(
|
public ControllerModel(
|
||||||
TypeInfo controllerType,
|
TypeInfo controllerType,
|
||||||
IReadOnlyList<object> attributes)
|
IReadOnlyList<object> attributes)
|
||||||
|
|
@ -41,6 +49,10 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
Selectors = new List<SelectorModel>();
|
Selectors = new List<SelectorModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="ControllerModel"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">The other controller model.</param>
|
||||||
public ControllerModel(ControllerModel other)
|
public ControllerModel(ControllerModel other)
|
||||||
{
|
{
|
||||||
if (other == null)
|
if (other == null)
|
||||||
|
|
@ -85,8 +97,14 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public ApiExplorerModel ApiExplorer { get; set; }
|
public ApiExplorerModel ApiExplorer { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the <see cref="ApplicationModel"/> of this controller.
|
||||||
|
/// </summary>
|
||||||
public ApplicationModel Application { get; set; }
|
public ApplicationModel Application { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The attributes of this controller.
|
||||||
|
/// </summary>
|
||||||
public IReadOnlyList<object> Attributes { get; }
|
public IReadOnlyList<object> Attributes { get; }
|
||||||
|
|
||||||
MemberInfo ICommonModel.MemberInfo => ControllerType;
|
MemberInfo ICommonModel.MemberInfo => ControllerType;
|
||||||
|
|
@ -94,7 +112,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
string ICommonModel.Name => ControllerName;
|
string ICommonModel.Name => ControllerName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of this controller.
|
/// Gets or sets the name of this controller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ControllerName { get; set; }
|
public string ControllerName { get; set; }
|
||||||
|
|
||||||
|
|
@ -103,8 +121,14 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TypeInfo ControllerType { get; }
|
public TypeInfo ControllerType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The properties of this controller.
|
||||||
|
/// </summary>
|
||||||
public IList<PropertyModel> ControllerProperties { get; }
|
public IList<PropertyModel> ControllerProperties { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The filter metadata of this controller.
|
||||||
|
/// </summary>
|
||||||
public IList<IFilterMetadata> Filters { get; }
|
public IList<IFilterMetadata> Filters { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -127,6 +151,9 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public IDictionary<object, object> Properties { get; }
|
public IDictionary<object, object> Properties { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The selector models of this controller..
|
||||||
|
/// </summary>
|
||||||
public IList<SelectorModel> Selectors { get; }
|
public IList<SelectorModel> Selectors { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,14 @@
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface that allows access to an ApiExplorerModel.
|
||||||
|
/// </summary>
|
||||||
public interface IApiExplorerModel
|
public interface IApiExplorerModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The ApiExporerModel.
|
||||||
|
/// </summary>
|
||||||
ApiExplorerModel ApiExplorer { get; set; }
|
ApiExplorerModel ApiExplorer { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,14 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface which is used to represent a something with a <see cref="BindingInfo"/>.
|
||||||
|
/// </summary>
|
||||||
public interface IBindingModel
|
public interface IBindingModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="BindingInfo"/>.
|
||||||
|
/// </summary>
|
||||||
BindingInfo BindingInfo { get; set; }
|
BindingInfo BindingInfo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,24 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ICommonModel interface.
|
||||||
|
/// </summary>
|
||||||
public interface ICommonModel : IPropertyModel
|
public interface ICommonModel : IPropertyModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The attributes.
|
||||||
|
/// </summary>
|
||||||
IReadOnlyList<object> Attributes { get; }
|
IReadOnlyList<object> Attributes { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The MemberInfo.
|
||||||
|
/// </summary>
|
||||||
MemberInfo MemberInfo { get; }
|
MemberInfo MemberInfo { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name.
|
||||||
|
/// </summary>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,14 @@ using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Model that has a list of <see cref="IFilterMetadata"/>.
|
||||||
|
/// </summary>
|
||||||
public interface IFilterModel
|
public interface IFilterModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// List of <see cref="IFilterMetadata"/>.
|
||||||
|
/// </summary>
|
||||||
IList<IFilterMetadata> Filters { get; }
|
IList<IFilterMetadata> Filters { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public interface IParameterModelConvention
|
public interface IParameterModelConvention
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Called to apply the convention to the <see cref="ParameterModel"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter">The <see cref="ParameterModel"/>.</param>
|
||||||
void Apply(ParameterModel parameter);
|
void Apply(ParameterModel parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,14 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface which is used to represent something with properties.
|
||||||
|
/// </summary>
|
||||||
public interface IPropertyModel
|
public interface IPropertyModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The properties.
|
||||||
|
/// </summary>
|
||||||
IDictionary<object, object> Properties { get; }
|
IDictionary<object, object> Properties { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -25,14 +25,27 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
private readonly IModelMetadataProvider _modelMetadataProvider;
|
private readonly IModelMetadataProvider _modelMetadataProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="InferParameterBindingInfoConvention"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="modelMetadataProvider">The model metadata provider.</param>
|
||||||
public InferParameterBindingInfoConvention(
|
public InferParameterBindingInfoConvention(
|
||||||
IModelMetadataProvider modelMetadataProvider)
|
IModelMetadataProvider modelMetadataProvider)
|
||||||
{
|
{
|
||||||
_modelMetadataProvider = modelMetadataProvider ?? throw new ArgumentNullException(nameof(modelMetadataProvider));
|
_modelMetadataProvider = modelMetadataProvider ?? throw new ArgumentNullException(nameof(modelMetadataProvider));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called to determine whether the action should apply.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="action">The action in question.</param>
|
||||||
|
/// <returns><see langword="true"/> if the action should apply.</returns>
|
||||||
protected virtual bool ShouldApply(ActionModel action) => true;
|
protected virtual bool ShouldApply(ActionModel action) => true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called to apply the convention to the <see cref="ActionModel"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="action">The <see cref="ActionModel"/>.</param>
|
||||||
public void Apply(ActionModel action)
|
public void Apply(ActionModel action)
|
||||||
{
|
{
|
||||||
if (action == null)
|
if (action == null)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -15,6 +15,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
private readonly ModelStateInvalidFilterFactory _filterFactory = new ModelStateInvalidFilterFactory();
|
private readonly ModelStateInvalidFilterFactory _filterFactory = new ModelStateInvalidFilterFactory();
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public void Apply(ActionModel action)
|
public void Apply(ActionModel action)
|
||||||
{
|
{
|
||||||
if (action == null)
|
if (action == null)
|
||||||
|
|
@ -30,6 +31,11 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
action.Filters.Add(_filterFactory);
|
action.Filters.Add(_filterFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called to determine whether the action should apply.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="action">The action in question.</param>
|
||||||
|
/// <returns><see langword="true"/> if the action should apply.</returns>
|
||||||
protected virtual bool ShouldApply(ActionModel action) => true;
|
protected virtual bool ShouldApply(ActionModel action) => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,17 @@ using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A type that represents a paramater.
|
||||||
|
/// </summary>
|
||||||
[DebuggerDisplay("ParameterModel: Name={ParameterName}")]
|
[DebuggerDisplay("ParameterModel: Name={ParameterName}")]
|
||||||
public class ParameterModel : ParameterModelBase, ICommonModel
|
public class ParameterModel : ParameterModelBase, ICommonModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new <see cref="ParameterModel"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameterInfo">The parameter info.</param>
|
||||||
|
/// <param name="attributes">The attributes.</param>
|
||||||
public ParameterModel(
|
public ParameterModel(
|
||||||
ParameterInfo parameterInfo,
|
ParameterInfo parameterInfo,
|
||||||
IReadOnlyList<object> attributes)
|
IReadOnlyList<object> attributes)
|
||||||
|
|
@ -20,6 +28,10 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
ParameterInfo = parameterInfo ?? throw new ArgumentNullException(nameof(parameterInfo));
|
ParameterInfo = parameterInfo ?? throw new ArgumentNullException(nameof(parameterInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new <see cref="ParameterModel"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">The parameter model to copy.</param>
|
||||||
public ParameterModel(ParameterModel other)
|
public ParameterModel(ParameterModel other)
|
||||||
: base(other)
|
: base(other)
|
||||||
{
|
{
|
||||||
|
|
@ -32,22 +44,40 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
ParameterInfo = other.ParameterInfo;
|
ParameterInfo = other.ParameterInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ActionModel"/>.
|
||||||
|
/// </summary>
|
||||||
public ActionModel Action { get; set; }
|
public ActionModel Action { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The properties.
|
||||||
|
/// </summary>
|
||||||
public new IDictionary<object, object> Properties => base.Properties;
|
public new IDictionary<object, object> Properties => base.Properties;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The attributes.
|
||||||
|
/// </summary>
|
||||||
public new IReadOnlyList<object> Attributes => base.Attributes;
|
public new IReadOnlyList<object> Attributes => base.Attributes;
|
||||||
|
|
||||||
MemberInfo ICommonModel.MemberInfo => ParameterInfo.Member;
|
MemberInfo ICommonModel.MemberInfo => ParameterInfo.Member;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ParameterInfo"/>.
|
||||||
|
/// </summary>
|
||||||
public ParameterInfo ParameterInfo { get; }
|
public ParameterInfo ParameterInfo { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parameter name.
|
||||||
|
/// </summary>
|
||||||
public string ParameterName
|
public string ParameterName
|
||||||
{
|
{
|
||||||
get => Name;
|
get => Name;
|
||||||
set => Name = value;
|
set => Name = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The display name.
|
||||||
|
/// </summary>
|
||||||
public string DisplayName
|
public string DisplayName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ParameterModelBase : IBindingModel
|
public abstract class ParameterModelBase : IBindingModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of a <see cref="ParameterModelBase"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameterType">The type.</param>
|
||||||
|
/// <param name="attributes">The attributes.</param>
|
||||||
protected ParameterModelBase(
|
protected ParameterModelBase(
|
||||||
Type parameterType,
|
Type parameterType,
|
||||||
IReadOnlyList<object> attributes)
|
IReadOnlyList<object> attributes)
|
||||||
|
|
@ -25,6 +30,10 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
Properties = new Dictionary<object, object>();
|
Properties = new Dictionary<object, object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">The other instance to copy</param>
|
||||||
protected ParameterModelBase(ParameterModelBase other)
|
protected ParameterModelBase(ParameterModelBase other)
|
||||||
{
|
{
|
||||||
if (other == null)
|
if (other == null)
|
||||||
|
|
@ -39,14 +48,29 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
Properties = new Dictionary<object, object>(other.Properties);
|
Properties = new Dictionary<object, object>(other.Properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The attributes.
|
||||||
|
/// </summary>
|
||||||
public IReadOnlyList<object> Attributes { get; }
|
public IReadOnlyList<object> Attributes { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The properties.
|
||||||
|
/// </summary>
|
||||||
public IDictionary<object, object> Properties { get; }
|
public IDictionary<object, object> Properties { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type.
|
||||||
|
/// </summary>
|
||||||
public Type ParameterType { get; }
|
public Type ParameterType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name.
|
||||||
|
/// </summary>
|
||||||
public string Name { get; protected set; }
|
public string Name { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="BindingInfo"/>.
|
||||||
|
/// </summary>
|
||||||
public BindingInfo BindingInfo { get; set; }
|
public BindingInfo BindingInfo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,20 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
|
|
||||||
MemberInfo ICommonModel.MemberInfo => PropertyInfo;
|
MemberInfo ICommonModel.MemberInfo => PropertyInfo;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public new IDictionary<object, object> Properties => base.Properties;
|
public new IDictionary<object, object> Properties => base.Properties;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public new IReadOnlyList<object> Attributes => base.Attributes;
|
public new IReadOnlyList<object> Attributes => base.Attributes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="PropertyInfo"/>.
|
||||||
|
/// </summary>
|
||||||
public PropertyInfo PropertyInfo { get; }
|
public PropertyInfo PropertyInfo { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the property.
|
||||||
|
/// </summary>
|
||||||
public string PropertyName
|
public string PropertyName
|
||||||
{
|
{
|
||||||
get => Name;
|
get => Name;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -29,6 +29,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
_parameterTransformer = parameterTransformer;
|
_parameterTransformer = parameterTransformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public void Apply(ActionModel action)
|
public void Apply(ActionModel action)
|
||||||
{
|
{
|
||||||
if (ShouldApply(action))
|
if (ShouldApply(action))
|
||||||
|
|
@ -37,6 +38,11 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called to determine whether an action should apply.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="action">The <see cref="ActionModel"/>.</param>
|
||||||
|
/// <returns><see langword="true"/> if the the action should apply.</returns>
|
||||||
protected virtual bool ShouldApply(ActionModel action) => true;
|
protected virtual bool ShouldApply(ActionModel action) => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -7,14 +7,24 @@ using Microsoft.AspNetCore.Mvc.ActionConstraints;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A type that represents a selector.
|
||||||
|
/// </summary>
|
||||||
public class SelectorModel
|
public class SelectorModel
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Intializes a new <see cref="SelectorModel"/>.
|
||||||
|
/// </summary>
|
||||||
public SelectorModel()
|
public SelectorModel()
|
||||||
{
|
{
|
||||||
ActionConstraints = new List<IActionConstraintMetadata>();
|
ActionConstraints = new List<IActionConstraintMetadata>();
|
||||||
EndpointMetadata = new List<object>();
|
EndpointMetadata = new List<object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Intializes a new <see cref="SelectorModel"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">The <see cref="SelectorModel"/> to copy from.</param>
|
||||||
public SelectorModel(SelectorModel other)
|
public SelectorModel(SelectorModel other)
|
||||||
{
|
{
|
||||||
if (other == null)
|
if (other == null)
|
||||||
|
|
@ -31,8 +41,14 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="AttributeRouteModel"/>.
|
||||||
|
/// </summary>
|
||||||
public AttributeRouteModel AttributeRouteModel { get; set; }
|
public AttributeRouteModel AttributeRouteModel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The list of <see cref="IActionConstraintMetadata"/>.
|
||||||
|
/// </summary>
|
||||||
public IList<IActionConstraintMetadata> ActionConstraints { get; }
|
public IList<IActionConstraintMetadata> ActionConstraints { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
IConsumesActionConstraint,
|
IConsumesActionConstraint,
|
||||||
IApiRequestMetadataProvider
|
IApiRequestMetadataProvider
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The order for consumes attribute.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>Defaults to 200</value>
|
||||||
public static readonly int ConsumesActionConstraintOrder = 200;
|
public static readonly int ConsumesActionConstraintOrder = 200;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -229,4 +233,4 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc
|
namespace Microsoft.AspNetCore.Mvc
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="ActionResult"/> that when executed will produce a response with content.
|
||||||
|
/// </summary>
|
||||||
public class ContentResult : ActionResult, IStatusCodeActionResult
|
public class ContentResult : ActionResult, IStatusCodeActionResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -25,6 +28,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? StatusCode { get; set; }
|
public int? StatusCode { get; set; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override Task ExecuteResultAsync(ActionContext context)
|
public override Task ExecuteResultAsync(ActionContext context)
|
||||||
{
|
{
|
||||||
if (context == null)
|
if (context == null)
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,9 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the <see cref="ProblemDetailsFactory"/>.
|
||||||
|
/// </summary>
|
||||||
public ProblemDetailsFactory ProblemDetailsFactory
|
public ProblemDetailsFactory ProblemDetailsFactory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -10,17 +10,33 @@ using Microsoft.Extensions.Internal;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Controllers
|
namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A descriptor for an action of a controller.
|
||||||
|
/// </summary>
|
||||||
[DebuggerDisplay("{DisplayName}")]
|
[DebuggerDisplay("{DisplayName}")]
|
||||||
public class ControllerActionDescriptor : ActionDescriptor
|
public class ControllerActionDescriptor : ActionDescriptor
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the controller.
|
||||||
|
/// </summary>
|
||||||
public string ControllerName { get; set; }
|
public string ControllerName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the action.
|
||||||
|
/// </summary>
|
||||||
public virtual string ActionName { get; set; }
|
public virtual string ActionName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="MethodInfo"/>.
|
||||||
|
/// </summary>
|
||||||
public MethodInfo MethodInfo { get; set; }
|
public MethodInfo MethodInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="TypeInfo"/> of the controller..
|
||||||
|
/// </summary>
|
||||||
public TypeInfo ControllerTypeInfo { get; set; }
|
public TypeInfo ControllerTypeInfo { get; set; }
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override string DisplayName
|
public override string DisplayName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -17,6 +17,10 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
private readonly Func<ControllerContext, object> _controllerActivatorCreate;
|
private readonly Func<ControllerContext, object> _controllerActivatorCreate;
|
||||||
private readonly Action<ControllerContext, object> _controllerActivatorRelease;
|
private readonly Action<ControllerContext, object> _controllerActivatorRelease;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="ControllerActivatorProvider"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="controllerActivator">A <see cref="IControllerActivator"/> which is delegated to when not the default implementation.</param>
|
||||||
public ControllerActivatorProvider(IControllerActivator controllerActivator)
|
public ControllerActivatorProvider(IControllerActivator controllerActivator)
|
||||||
{
|
{
|
||||||
if (controllerActivator == null)
|
if (controllerActivator == null)
|
||||||
|
|
@ -32,6 +36,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public Func<ControllerContext, object> CreateActivator(ControllerActionDescriptor descriptor)
|
public Func<ControllerContext, object> CreateActivator(ControllerActionDescriptor descriptor)
|
||||||
{
|
{
|
||||||
if (descriptor == null)
|
if (descriptor == null)
|
||||||
|
|
@ -57,6 +62,7 @@ namespace Microsoft.AspNetCore.Mvc.Controllers
|
||||||
return controllerContext => typeActivator(controllerContext.HttpContext.RequestServices, arguments: null);
|
return controllerContext => typeActivator(controllerContext.HttpContext.RequestServices, arguments: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public Action<ControllerContext, object> CreateReleaser(ControllerActionDescriptor descriptor)
|
public Action<ControllerContext, object> CreateReleaser(ControllerActionDescriptor descriptor)
|
||||||
{
|
{
|
||||||
if (descriptor == null)
|
if (descriptor == null)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
@ -6,9 +6,16 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc
|
namespace Microsoft.AspNetCore.Mvc
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default api conventions.
|
||||||
|
/// </summary>
|
||||||
public static class DefaultApiConventions
|
public static class DefaultApiConventions
|
||||||
{
|
{
|
||||||
#region GET
|
#region GET
|
||||||
|
/// <summary>
|
||||||
|
/// Get convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
|
|
@ -18,6 +25,10 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
||||||
object id) { }
|
object id) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
|
|
@ -29,6 +40,10 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
{ }
|
{ }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Post convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
#region POST
|
#region POST
|
||||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
|
@ -39,6 +54,10 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
||||||
object model) { }
|
object model) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
[ProducesDefaultResponseType]
|
[ProducesDefaultResponseType]
|
||||||
|
|
@ -51,6 +70,11 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PUT
|
#region PUT
|
||||||
|
/// <summary>
|
||||||
|
/// Put convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="model"></param>
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
|
@ -65,6 +89,11 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
[ApiConventionTypeMatch(ApiConventionTypeMatchBehavior.Any)]
|
||||||
object model) { }
|
object model) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Edit convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="model"></param>
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
|
@ -80,6 +109,11 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
object model)
|
object model)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="model"></param>
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
|
@ -97,6 +131,10 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region DELETE
|
#region DELETE
|
||||||
|
/// <summary>
|
||||||
|
/// Delete convention.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -7,11 +7,22 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A base class that for an event.
|
||||||
|
/// </summary>
|
||||||
public abstract class EventData : IReadOnlyList<KeyValuePair<string, object>>
|
public abstract class EventData : IReadOnlyList<KeyValuePair<string, object>>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The namespace of the event.
|
||||||
|
/// </summary>
|
||||||
protected const string EventNamespace = "Microsoft.AspNetCore.Mvc.";
|
protected const string EventNamespace = "Microsoft.AspNetCore.Mvc.";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The event count.
|
||||||
|
/// </summary>
|
||||||
protected abstract int Count { get; }
|
protected abstract int Count { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected abstract KeyValuePair<string, object> this[int index] { get; }
|
protected abstract KeyValuePair<string, object> this[int index] { get; }
|
||||||
|
|
||||||
int IReadOnlyCollection<KeyValuePair<string, object>>.Count => Count;
|
int IReadOnlyCollection<KeyValuePair<string, object>>.Count => Count;
|
||||||
|
|
@ -25,6 +36,9 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
=> GetEnumerator();
|
=> GetEnumerator();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A struct that represents an Enumerator
|
||||||
|
/// </summary>
|
||||||
public struct Enumerator : IEnumerator<KeyValuePair<string, object>>
|
public struct Enumerator : IEnumerator<KeyValuePair<string, object>>
|
||||||
{
|
{
|
||||||
private readonly EventData _eventData;
|
private readonly EventData _eventData;
|
||||||
|
|
@ -32,6 +46,9 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
|
|
||||||
private int _index;
|
private int _index;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current keyvalue pair.
|
||||||
|
/// </summary>
|
||||||
public KeyValuePair<string, object> Current { get; private set; }
|
public KeyValuePair<string, object> Current { get; private set; }
|
||||||
|
|
||||||
internal Enumerator(EventData eventData)
|
internal Enumerator(EventData eventData)
|
||||||
|
|
@ -42,6 +59,7 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
Current = default;
|
Current = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
var index = _index + 1;
|
var index = _index + 1;
|
||||||
|
|
@ -56,6 +74,7 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
object IEnumerator.Current => Current;
|
object IEnumerator.Current => Current;
|
||||||
void IEnumerator.Reset() => throw new NotSupportedException();
|
void IEnumerator.Reset() => throw new NotSupportedException();
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Mvc.Core;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Filters
|
namespace Microsoft.AspNetCore.Mvc.Filters
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A collection of <see cref="IFilterMetadata"/>.
|
||||||
|
/// </summary>
|
||||||
public class FilterCollection : Collection<IFilterMetadata>
|
public class FilterCollection : Collection<IFilterMetadata>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,29 @@ namespace Microsoft.AspNetCore.Mvc.Filters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class FilterScope
|
public static class FilterScope
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// First filter scope.
|
||||||
|
/// </summary>
|
||||||
public static readonly int First = 0;
|
public static readonly int First = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Global filter scope.
|
||||||
|
/// </summary>
|
||||||
public static readonly int Global = 10;
|
public static readonly int Global = 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Controller filter scope.
|
||||||
|
/// </summary>
|
||||||
public static readonly int Controller = 20;
|
public static readonly int Controller = 20;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Action filter scope.
|
||||||
|
/// </summary>
|
||||||
public static readonly int Action = 30;
|
public static readonly int Action = 30;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Last filter scope.
|
||||||
|
/// </summary>
|
||||||
public static readonly int Last = 100;
|
public static readonly int Last = 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -28,6 +28,9 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
ConfigurationType = configurationType;
|
ConfigurationType = configurationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type which configures a middleware pipeline.
|
||||||
|
/// </summary>
|
||||||
public Type ConfigurationType { get; }
|
public Type ConfigurationType { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
||||||
|
|
@ -374,11 +374,21 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an encoding for a mediaType.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediaType">The mediaType.</param>
|
||||||
|
/// <returns>The encoding.</returns>
|
||||||
public static Encoding GetEncoding(string mediaType)
|
public static Encoding GetEncoding(string mediaType)
|
||||||
{
|
{
|
||||||
return GetEncoding(new StringSegment(mediaType));
|
return GetEncoding(new StringSegment(mediaType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get an encoding for a mediaType.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mediaType">The mediaType.</param>
|
||||||
|
/// <returns>The encoding.</returns>
|
||||||
public static Encoding GetEncoding(StringSegment mediaType)
|
public static Encoding GetEncoding(StringSegment mediaType)
|
||||||
{
|
{
|
||||||
var parsedMediaType = new MediaType(mediaType);
|
var parsedMediaType = new MediaType(mediaType);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StringOutputFormatter : TextOutputFormatter
|
public class StringOutputFormatter : TextOutputFormatter
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new <see cref="StringOutputFormatter"/>.
|
||||||
|
/// </summary>
|
||||||
public StringOutputFormatter()
|
public StringOutputFormatter()
|
||||||
{
|
{
|
||||||
SupportedEncodings.Add(Encoding.UTF8);
|
SupportedEncodings.Add(Encoding.UTF8);
|
||||||
|
|
@ -20,6 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
SupportedMediaTypes.Add("text/plain");
|
SupportedMediaTypes.Add("text/plain");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override bool CanWriteResult(OutputFormatterCanWriteContext context)
|
public override bool CanWriteResult(OutputFormatterCanWriteContext context)
|
||||||
{
|
{
|
||||||
if (context == null)
|
if (context == null)
|
||||||
|
|
@ -36,6 +40,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding encoding)
|
public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding encoding)
|
||||||
{
|
{
|
||||||
if (context == null)
|
if (context == null)
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,16 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type that provides access to an <see cref="ActionContext"/>.
|
||||||
|
/// </summary>
|
||||||
public class ActionContextAccessor : IActionContextAccessor
|
public class ActionContextAccessor : IActionContextAccessor
|
||||||
{
|
{
|
||||||
internal static readonly IActionContextAccessor Null = new NullActionContextAccessor();
|
internal static readonly IActionContextAccessor Null = new NullActionContextAccessor();
|
||||||
|
|
||||||
private static readonly AsyncLocal<ActionContext> _storage = new AsyncLocal<ActionContext>();
|
private static readonly AsyncLocal<ActionContext> _storage = new AsyncLocal<ActionContext>();
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public ActionContext ActionContext
|
public ActionContext ActionContext
|
||||||
{
|
{
|
||||||
get { return _storage.Value; }
|
get { return _storage.Value; }
|
||||||
|
|
@ -26,4 +30,4 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -8,12 +8,20 @@ using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{ContentResult}"/> that is responsible for <see cref="ContentResult"/>
|
||||||
|
/// </summary>
|
||||||
public class ContentResultExecutor : IActionResultExecutor<ContentResult>
|
public class ContentResultExecutor : IActionResultExecutor<ContentResult>
|
||||||
{
|
{
|
||||||
private const string DefaultContentType = "text/plain; charset=utf-8";
|
private const string DefaultContentType = "text/plain; charset=utf-8";
|
||||||
private readonly ILogger<ContentResultExecutor> _logger;
|
private readonly ILogger<ContentResultExecutor> _logger;
|
||||||
private readonly IHttpResponseStreamWriterFactory _httpResponseStreamWriterFactory;
|
private readonly IHttpResponseStreamWriterFactory _httpResponseStreamWriterFactory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="ContentResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger">The logger to use.</param>
|
||||||
|
/// <param name="httpResponseStreamWriterFactory">The stream writer factory.</param>
|
||||||
public ContentResultExecutor(ILogger<ContentResultExecutor> logger, IHttpResponseStreamWriterFactory httpResponseStreamWriterFactory)
|
public ContentResultExecutor(ILogger<ContentResultExecutor> logger, IHttpResponseStreamWriterFactory httpResponseStreamWriterFactory)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -14,6 +14,9 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The default implementation of <see cref="OutputFormatterSelector"/>.
|
||||||
|
/// </summary>
|
||||||
public class DefaultOutputFormatterSelector : OutputFormatterSelector
|
public class DefaultOutputFormatterSelector : OutputFormatterSelector
|
||||||
{
|
{
|
||||||
private static readonly Comparison<MediaTypeSegmentWithQuality> _sortFunction = (left, right) =>
|
private static readonly Comparison<MediaTypeSegmentWithQuality> _sortFunction = (left, right) =>
|
||||||
|
|
@ -26,6 +29,11 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
private readonly bool _respectBrowserAcceptHeader;
|
private readonly bool _respectBrowserAcceptHeader;
|
||||||
private readonly bool _returnHttpNotAcceptable;
|
private readonly bool _returnHttpNotAcceptable;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="DefaultOutputFormatterSelector"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="options">Used to access <see cref="MvcOptions"/>.</param>
|
||||||
|
/// <param name="loggerFactory">The logger factory.</param>
|
||||||
public DefaultOutputFormatterSelector(IOptions<MvcOptions> options, ILoggerFactory loggerFactory)
|
public DefaultOutputFormatterSelector(IOptions<MvcOptions> options, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
if (options == null)
|
if (options == null)
|
||||||
|
|
@ -45,6 +53,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
_returnHttpNotAcceptable = options.Value.ReturnHttpNotAcceptable;
|
_returnHttpNotAcceptable = options.Value.ReturnHttpNotAcceptable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override IOutputFormatter SelectFormatter(OutputFormatterCanWriteContext context, IList<IOutputFormatter> formatters, MediaTypeCollection contentTypes)
|
public override IOutputFormatter SelectFormatter(OutputFormatterCanWriteContext context, IList<IOutputFormatter> formatters, MediaTypeCollection contentTypes)
|
||||||
{
|
{
|
||||||
if (context == null)
|
if (context == null)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -9,8 +9,15 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{FileContentResult}"/>
|
||||||
|
/// </summary>
|
||||||
public class FileContentResultExecutor : FileResultExecutorBase, IActionResultExecutor<FileContentResult>
|
public class FileContentResultExecutor : FileResultExecutorBase, IActionResultExecutor<FileContentResult>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Intializes a new <see cref="FileContentResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
public FileContentResultExecutor(ILoggerFactory loggerFactory)
|
public FileContentResultExecutor(ILoggerFactory loggerFactory)
|
||||||
: base(CreateLogger<FileContentResultExecutor>(loggerFactory))
|
: base(CreateLogger<FileContentResultExecutor>(loggerFactory))
|
||||||
{
|
{
|
||||||
|
|
@ -47,6 +54,14 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return WriteFileAsync(context, result, range, rangeLength);
|
return WriteFileAsync(context, result, range, rangeLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Writes the file content.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The action context.</param>
|
||||||
|
/// <param name="result">The <see cref="FileContentResult"/>.</param>
|
||||||
|
/// <param name="range">The <see cref="RangeItemHeaderValue"/>.</param>
|
||||||
|
/// <param name="rangeLength">The length of the range.</param>
|
||||||
|
/// <returns></returns>
|
||||||
protected virtual Task WriteFileAsync(ActionContext context, FileContentResult result, RangeItemHeaderValue range, long rangeLength)
|
protected virtual Task WriteFileAsync(ActionContext context, FileContentResult result, RangeItemHeaderValue range, long rangeLength)
|
||||||
{
|
{
|
||||||
if (context == null)
|
if (context == null)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -15,12 +15,22 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base class for a file result.
|
||||||
|
/// </summary>
|
||||||
public class FileResultExecutorBase
|
public class FileResultExecutorBase
|
||||||
{
|
{
|
||||||
private const string AcceptRangeHeaderValue = "bytes";
|
private const string AcceptRangeHeaderValue = "bytes";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The buffer size: 64 * 1024.
|
||||||
|
/// </summary>
|
||||||
protected const int BufferSize = 64 * 1024;
|
protected const int BufferSize = 64 * 1024;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Intializes a new <see cref="FileResultExecutorBase"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
public FileResultExecutorBase(ILogger logger)
|
public FileResultExecutorBase(ILogger logger)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
|
|
@ -34,8 +44,21 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
PreconditionFailed
|
PreconditionFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The logger to use.
|
||||||
|
/// </summary>
|
||||||
protected ILogger Logger { get; }
|
protected ILogger Logger { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets etag and last modified headers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The <see cref="ActionContext"/>.</param>
|
||||||
|
/// <param name="result">The <see cref="FileResult"/>.</param>
|
||||||
|
/// <param name="fileLength">The nullable file length.</param>
|
||||||
|
/// <param name="enableRangeProcessing">Whether range processing is enabled.</param>
|
||||||
|
/// <param name="lastModified">The nullable lastModified date.</param>
|
||||||
|
/// <param name="etag">The <see cref="EntityTagHeaderValue"/>.</param>
|
||||||
|
/// <returns>A tuple with the <see cref="RangeItemHeaderValue"/> range, length, and whether the body was served.</returns>
|
||||||
protected virtual (RangeItemHeaderValue range, long rangeLength, bool serveBody) SetHeadersAndLog(
|
protected virtual (RangeItemHeaderValue range, long rangeLength, bool serveBody) SetHeadersAndLog(
|
||||||
ActionContext context,
|
ActionContext context,
|
||||||
FileResult result,
|
FileResult result,
|
||||||
|
|
@ -348,6 +371,12 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a logger using the factory.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type being logged.</typeparam>
|
||||||
|
/// <param name="factory">The <see cref="ILoggerFactory"/>.</param>
|
||||||
|
/// <returns>An <see cref="ILogger"/>.</returns>
|
||||||
protected static ILogger CreateLogger<T>(ILoggerFactory factory)
|
protected static ILogger CreateLogger<T>(ILoggerFactory factory)
|
||||||
{
|
{
|
||||||
if (factory == null)
|
if (factory == null)
|
||||||
|
|
@ -358,6 +387,14 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return factory.CreateLogger<T>();
|
return factory.CreateLogger<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the contents of the fileStream to the response body.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The <see cref="HttpContext"/>.</param>
|
||||||
|
/// <param name="fileStream">The fileStream to write.</param>
|
||||||
|
/// <param name="range">The <see cref="RangeItemHeaderValue"/>.</param>
|
||||||
|
/// <param name="rangeLength">The range length.</param>
|
||||||
|
/// <returns>The async task.</returns>
|
||||||
protected static async Task WriteFileAsync(HttpContext context, Stream fileStream, RangeItemHeaderValue range, long rangeLength)
|
protected static async Task WriteFileAsync(HttpContext context, Stream fileStream, RangeItemHeaderValue range, long rangeLength)
|
||||||
{
|
{
|
||||||
var outputStream = context.Response.Body;
|
var outputStream = context.Response.Body;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -8,8 +8,15 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="IActionResultExecutor{FileStreamResult}"/> for a file stream result.
|
||||||
|
/// </summary>
|
||||||
public class FileStreamResultExecutor : FileResultExecutorBase, IActionResultExecutor<FileStreamResult>
|
public class FileStreamResultExecutor : FileResultExecutorBase, IActionResultExecutor<FileStreamResult>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new <see cref="FileStreamResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
public FileStreamResultExecutor(ILoggerFactory loggerFactory)
|
public FileStreamResultExecutor(ILoggerFactory loggerFactory)
|
||||||
: base(CreateLogger<FileStreamResultExecutor>(loggerFactory))
|
: base(CreateLogger<FileStreamResultExecutor>(loggerFactory))
|
||||||
{
|
{
|
||||||
|
|
@ -55,6 +62,14 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write the contents of the FileStreamResult to the response body.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The <see cref="ActionContext"/>.</param>
|
||||||
|
/// <param name="result">The FileStreamResult to write.</param>
|
||||||
|
/// <param name="range">The <see cref="RangeItemHeaderValue"/>.</param>
|
||||||
|
/// <param name="rangeLength">The range length.</param>
|
||||||
|
/// <returns>The async task.</returns>
|
||||||
protected virtual Task WriteFileAsync(
|
protected virtual Task WriteFileAsync(
|
||||||
ActionContext context,
|
ActionContext context,
|
||||||
FileStreamResult result,
|
FileStreamResult result,
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,14 @@
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Defines an interface for exposing an <see cref="ActionContext"/>.
|
||||||
|
/// </summary>
|
||||||
public interface IActionContextAccessor
|
public interface IActionContextAccessor
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the <see cref="ActionContext"/>.
|
||||||
|
/// </summary>
|
||||||
ActionContext ActionContext { get; set; }
|
ActionContext ActionContext { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -11,11 +11,19 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{LocalRedirectResult}"/> that handles <see cref="LocalRedirectResult"/>.
|
||||||
|
/// </summary>
|
||||||
public class LocalRedirectResultExecutor : IActionResultExecutor<LocalRedirectResult>
|
public class LocalRedirectResultExecutor : IActionResultExecutor<LocalRedirectResult>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IUrlHelperFactory _urlHelperFactory;
|
private readonly IUrlHelperFactory _urlHelperFactory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="LocalRedirectResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">Used to create loggers.</param>
|
||||||
|
/// <param name="urlHelperFactory">Used to create url helpers.</param>
|
||||||
public LocalRedirectResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
public LocalRedirectResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
||||||
{
|
{
|
||||||
if (loggerFactory == null)
|
if (loggerFactory == null)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -20,6 +20,11 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
private readonly ApiBehaviorOptions _apiBehaviorOptions;
|
private readonly ApiBehaviorOptions _apiBehaviorOptions;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="ModelStateInvalidFilter"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="apiBehaviorOptions">The api behavior options.</param>
|
||||||
|
/// <param name="logger">The logger.</param>
|
||||||
public ModelStateInvalidFilter(ApiBehaviorOptions apiBehaviorOptions, ILogger logger)
|
public ModelStateInvalidFilter(ApiBehaviorOptions apiBehaviorOptions, ILogger logger)
|
||||||
{
|
{
|
||||||
_apiBehaviorOptions = apiBehaviorOptions ?? throw new ArgumentNullException(nameof(apiBehaviorOptions));
|
_apiBehaviorOptions = apiBehaviorOptions ?? throw new ArgumentNullException(nameof(apiBehaviorOptions));
|
||||||
|
|
@ -54,10 +59,18 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool IsReusable => true;
|
public bool IsReusable => true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when an action is executed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The <see cref="ActionExecutedContext"/>.</param>
|
||||||
public void OnActionExecuted(ActionExecutedContext context)
|
public void OnActionExecuted(ActionExecutedContext context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when an action is executing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">The <see cref="ActionExecutingContext"/>.</param>
|
||||||
public void OnActionExecuting(ActionExecutingContext context)
|
public void OnActionExecuting(ActionExecutingContext context)
|
||||||
{
|
{
|
||||||
if (context.Result == null && !context.ModelState.IsValid)
|
if (context.Result == null && !context.ModelState.IsValid)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -13,8 +13,15 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{PhysicalFileResult}"/> for <see cref="PhysicalFileResult"/>.
|
||||||
|
/// </summary>
|
||||||
public class PhysicalFileResultExecutor : FileResultExecutorBase, IActionResultExecutor<PhysicalFileResult>
|
public class PhysicalFileResultExecutor : FileResultExecutorBase, IActionResultExecutor<PhysicalFileResult>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PhysicalFileResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
public PhysicalFileResultExecutor(ILoggerFactory loggerFactory)
|
public PhysicalFileResultExecutor(ILoggerFactory loggerFactory)
|
||||||
: base(CreateLogger<PhysicalFileResultExecutor>(loggerFactory))
|
: base(CreateLogger<PhysicalFileResultExecutor>(loggerFactory))
|
||||||
{
|
{
|
||||||
|
|
@ -59,6 +66,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected virtual Task WriteFileAsync(ActionContext context, PhysicalFileResult result, RangeItemHeaderValue range, long rangeLength)
|
protected virtual Task WriteFileAsync(ActionContext context, PhysicalFileResult result, RangeItemHeaderValue range, long rangeLength)
|
||||||
{
|
{
|
||||||
if (context == null)
|
if (context == null)
|
||||||
|
|
@ -99,6 +107,9 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
count: null);
|
count: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Obsolete. This API is no longer called.
|
||||||
|
/// </summary>
|
||||||
[Obsolete("This API is no longer called.")]
|
[Obsolete("This API is no longer called.")]
|
||||||
protected virtual Stream GetFileStream(string path)
|
protected virtual Stream GetFileStream(string path)
|
||||||
{
|
{
|
||||||
|
|
@ -116,6 +127,11 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
FileOptions.Asynchronous | FileOptions.SequentialScan);
|
FileOptions.Asynchronous | FileOptions.SequentialScan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the file metadata for a path.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The file path.</param>
|
||||||
|
/// <returns>The <see cref="FileMetadata"/> for the path.</returns>
|
||||||
protected virtual FileMetadata GetFileInfo(string path)
|
protected virtual FileMetadata GetFileInfo(string path)
|
||||||
{
|
{
|
||||||
var fileInfo = new FileInfo(path);
|
var fileInfo = new FileInfo(path);
|
||||||
|
|
@ -127,12 +143,24 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents metadata for a file.
|
||||||
|
/// </summary>
|
||||||
protected class FileMetadata
|
protected class FileMetadata
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Whether a file exists.
|
||||||
|
/// </summary>
|
||||||
public bool Exists { get; set; }
|
public bool Exists { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The file length.
|
||||||
|
/// </summary>
|
||||||
public long Length { get; set; }
|
public long Length { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When the file was last modified.
|
||||||
|
/// </summary>
|
||||||
public DateTimeOffset LastModified { get; set; }
|
public DateTimeOffset LastModified { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -10,11 +10,19 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{VirtualFileResult}"/> for <see cref="RedirectResult"/>.
|
||||||
|
/// </summary>
|
||||||
public class RedirectResultExecutor : IActionResultExecutor<RedirectResult>
|
public class RedirectResultExecutor : IActionResultExecutor<RedirectResult>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IUrlHelperFactory _urlHelperFactory;
|
private readonly IUrlHelperFactory _urlHelperFactory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="RedirectResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
|
/// <param name="urlHelperFactory">The factory used to create url helpers.</param>
|
||||||
public RedirectResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
public RedirectResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
||||||
{
|
{
|
||||||
if (loggerFactory == null)
|
if (loggerFactory == null)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -11,11 +11,19 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{RedirectToActionResult}"/> for <see cref="RedirectToActionResult"/>.
|
||||||
|
/// </summary>
|
||||||
public class RedirectToActionResultExecutor : IActionResultExecutor<RedirectToActionResult>
|
public class RedirectToActionResultExecutor : IActionResultExecutor<RedirectToActionResult>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IUrlHelperFactory _urlHelperFactory;
|
private readonly IUrlHelperFactory _urlHelperFactory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PhysicalFileResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
|
/// <param name="urlHelperFactory">The factory used to create url helpers.</param>
|
||||||
public RedirectToActionResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
public RedirectToActionResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
||||||
{
|
{
|
||||||
if (loggerFactory == null)
|
if (loggerFactory == null)
|
||||||
|
|
@ -75,4 +83,4 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -11,11 +11,19 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{RedirectToPageResult}"/> for <see cref="RedirectToPageResult"/>.
|
||||||
|
/// </summary>
|
||||||
public class RedirectToPageResultExecutor : IActionResultExecutor<RedirectToPageResult>
|
public class RedirectToPageResultExecutor : IActionResultExecutor<RedirectToPageResult>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IUrlHelperFactory _urlHelperFactory;
|
private readonly IUrlHelperFactory _urlHelperFactory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="RedirectToPageResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
|
/// <param name="urlHelperFactory">The factory used to create url helpers.</param>
|
||||||
public RedirectToPageResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
public RedirectToPageResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
||||||
{
|
{
|
||||||
if (loggerFactory == null)
|
if (loggerFactory == null)
|
||||||
|
|
@ -75,4 +83,4 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -11,11 +11,19 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{RedirectToRouteResult}"/> for <see cref="RedirectToRouteResult"/>.
|
||||||
|
/// </summary>
|
||||||
public class RedirectToRouteResultExecutor : IActionResultExecutor<RedirectToRouteResult>
|
public class RedirectToRouteResultExecutor : IActionResultExecutor<RedirectToRouteResult>
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IUrlHelperFactory _urlHelperFactory;
|
private readonly IUrlHelperFactory _urlHelperFactory;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="RedirectToRouteResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
|
/// <param name="urlHelperFactory">The factory used to create url helpers.</param>
|
||||||
public RedirectToRouteResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
public RedirectToRouteResultExecutor(ILoggerFactory loggerFactory, IUrlHelperFactory urlHelperFactory)
|
||||||
{
|
{
|
||||||
if (loggerFactory == null)
|
if (loggerFactory == null)
|
||||||
|
|
@ -64,4 +72,4 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -15,10 +15,18 @@ using Microsoft.Net.Http.Headers;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IActionResultExecutor{VirtualFileResult}"/> for <see cref="VirtualFileResult"/>.
|
||||||
|
/// </summary>
|
||||||
public class VirtualFileResultExecutor : FileResultExecutorBase, IActionResultExecutor<VirtualFileResult>
|
public class VirtualFileResultExecutor : FileResultExecutorBase, IActionResultExecutor<VirtualFileResult>
|
||||||
{
|
{
|
||||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="VirtualFileResultExecutor"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">The factory used to create loggers.</param>
|
||||||
|
/// <param name="hostingEnvironment">The hosting enviornment</param>
|
||||||
public VirtualFileResultExecutor(ILoggerFactory loggerFactory, IWebHostEnvironment hostingEnvironment)
|
public VirtualFileResultExecutor(ILoggerFactory loggerFactory, IWebHostEnvironment hostingEnvironment)
|
||||||
: base(CreateLogger<VirtualFileResultExecutor>(loggerFactory))
|
: base(CreateLogger<VirtualFileResultExecutor>(loggerFactory))
|
||||||
{
|
{
|
||||||
|
|
@ -69,6 +77,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected virtual Task WriteFileAsync(ActionContext context, VirtualFileResult result, IFileInfo fileInfo, RangeItemHeaderValue range, long rangeLength)
|
protected virtual Task WriteFileAsync(ActionContext context, VirtualFileResult result, IFileInfo fileInfo, RangeItemHeaderValue range, long rangeLength)
|
||||||
{
|
{
|
||||||
if (context == null)
|
if (context == null)
|
||||||
|
|
@ -134,6 +143,11 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
|
||||||
return result.FileProvider;
|
return result.FileProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Obsolete, this API is no longer called.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileInfo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
[Obsolete("This API is no longer called.")]
|
[Obsolete("This API is no longer called.")]
|
||||||
protected virtual Stream GetFileStream(IFileInfo fileInfo)
|
protected virtual Stream GetFileStream(IFileInfo fileInfo)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
@ -6,6 +6,9 @@ using Microsoft.AspNetCore.Mvc.Formatters;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc
|
namespace Microsoft.AspNetCore.Mvc
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options to configure <see cref="SystemTextJsonInputFormatter"/> and <see cref="SystemTextJsonOutputFormatter"/>.
|
||||||
|
/// </summary>
|
||||||
public class JsonOptions
|
public class JsonOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Microsoft.AspNetCore.Mvc.RequireHttpsAttribute
|
||||||
Microsoft.AspNetCore.Mvc.RouteAttribute</Description>
|
Microsoft.AspNetCore.Mvc.RouteAttribute</Description>
|
||||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||||
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public Task BindModelAsync(ModelBindingContext bindingContext)
|
public Task BindModelAsync(ModelBindingContext bindingContext)
|
||||||
{
|
{
|
||||||
if (bindingContext == null)
|
if (bindingContext == null)
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
_logger = loggerFactory.CreateLogger<ComplexTypeModelBinder>();
|
_logger = loggerFactory.CreateLogger<ComplexTypeModelBinder>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public Task BindModelAsync(ModelBindingContext bindingContext)
|
public Task BindModelAsync(ModelBindingContext bindingContext)
|
||||||
{
|
{
|
||||||
if (bindingContext == null)
|
if (bindingContext == null)
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
return base.CreateEmptyCollection(targetType);
|
return base.CreateEmptyCollection(targetType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override bool CanCreateInstance(Type targetType)
|
public override bool CanCreateInstance(Type targetType)
|
||||||
{
|
{
|
||||||
if (targetType.IsAssignableFrom(typeof(Dictionary<TKey, TValue>)))
|
if (targetType.IsAssignableFrom(typeof(Dictionary<TKey, TValue>)))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -40,6 +40,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected override void CheckModel(
|
protected override void CheckModel(
|
||||||
ModelBindingContext bindingContext,
|
ModelBindingContext bindingContext,
|
||||||
ValueProviderResult valueProviderResult,
|
ValueProviderResult valueProviderResult,
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected virtual void CheckModel(
|
protected virtual void CheckModel(
|
||||||
ModelBindingContext bindingContext,
|
ModelBindingContext bindingContext,
|
||||||
ValueProviderResult valueProviderResult,
|
ValueProviderResult valueProviderResult,
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,14 @@ using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="DefaultBindingMetadataProvider"/> that represents an empty model.
|
||||||
|
/// </summary>
|
||||||
public class EmptyModelMetadataProvider : DefaultModelMetadataProvider
|
public class EmptyModelMetadataProvider : DefaultModelMetadataProvider
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new <see cref="EmptyModelMetadataProvider"/>.
|
||||||
|
/// </summary>
|
||||||
public EmptyModelMetadataProvider()
|
public EmptyModelMetadataProvider()
|
||||||
: base(
|
: base(
|
||||||
new DefaultCompositeMetadataDetailsProvider(new List<IMetadataDetailsProvider>()),
|
new DefaultCompositeMetadataDetailsProvider(new List<IMetadataDetailsProvider>()),
|
||||||
|
|
@ -21,4 +27,4 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
public MvcOptions Value { get; } = new MvcOptions();
|
public MvcOptions Value { get; } = new MvcOptions();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,14 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
Culture = culture;
|
Culture = culture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The culture to use.
|
||||||
|
/// </summary>
|
||||||
public CultureInfo Culture { get; }
|
public CultureInfo Culture { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The prefix container.
|
||||||
|
/// </summary>
|
||||||
protected PrefixContainer PrefixContainer
|
protected PrefixContainer PrefixContainer
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,16 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface representing an enumerable <see cref="IValueProvider"/>.
|
||||||
|
/// </summary>
|
||||||
public interface IEnumerableValueProvider : IValueProvider
|
public interface IEnumerableValueProvider : IValueProvider
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the keys for a specific prefix.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prefix">The prefix to enumerate.</param>
|
||||||
|
/// <returns>The keys for the prefix.</returns>
|
||||||
IDictionary<string, string> GetKeysFromPrefix(string prefix);
|
IDictionary<string, string> GetKeysFromPrefix(string prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides <see cref="BindingMetadata"/> for a <see cref="DefaultModelMetadata"/>.
|
||||||
|
/// </summary>
|
||||||
public class BindingSourceMetadataProvider : IBindingMetadataProvider
|
public class BindingSourceMetadataProvider : IBindingMetadataProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -28,7 +31,16 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
BindingSource = bindingSource;
|
BindingSource = bindingSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="Type"/>. The provider sets <see cref="BindingSource"/> of the given <see cref="Type"/> or
|
||||||
|
/// anything assignable to the given <see cref="Type"/>.
|
||||||
|
/// </summary>
|
||||||
public Type Type { get; }
|
public Type Type { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="BindingSource"/> to assign to the Type.
|
||||||
|
/// </summary>
|
||||||
public BindingSource BindingSource { get; }
|
public BindingSource BindingSource { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
||||||
|
|
@ -407,6 +407,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override IReadOnlyList<ModelMetadata> BoundConstructorParameters => _details.BoundConstructorParameters;
|
public override IReadOnlyList<ModelMetadata> BoundConstructorParameters => _details.BoundConstructorParameters;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
@ -561,6 +562,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Action<object, object> PropertySetter => _details.PropertySetter;
|
public override Action<object, object> PropertySetter => _details.PropertySetter;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override Func<object[], object> BoundConstructorInvoker => _details.BoundConstructorInvoker;
|
public override Func<object[], object> BoundConstructorInvoker => _details.BoundConstructorInvoker;
|
||||||
|
|
||||||
internal DefaultMetadataDetails Details => _details;
|
internal DefaultMetadataDetails Details => _details;
|
||||||
|
|
|
||||||
|
|
@ -426,6 +426,13 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
|
||||||
ModelAttributes.GetAttributesForType(key.ModelType));
|
ModelAttributes.GetAttributesForType(key.ModelType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the <see cref="DefaultMetadataDetails"/> entry for a parameter <see cref="Type"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">
|
||||||
|
/// The <see cref="ModelMetadataIdentity"/> identifying the parameter <see cref="Type"/>.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>A details object for the parameter.</returns>
|
||||||
protected virtual DefaultMetadataDetails CreateParameterDetails(ModelMetadataIdentity key)
|
protected virtual DefaultMetadataDetails CreateParameterDetails(ModelMetadataIdentity key)
|
||||||
{
|
{
|
||||||
return new DefaultMetadataDetails(
|
return new DefaultMetadataDetails(
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,39 @@ using System.Globalization;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class for helpers dealing with model names.
|
||||||
|
/// </summary>
|
||||||
public static class ModelNames
|
public static class ModelNames
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Create an index model name from the parent name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parentName">The parent name.</param>
|
||||||
|
/// <param name="index">The index.</param>
|
||||||
|
/// <returns>The index model name.</returns>
|
||||||
public static string CreateIndexModelName(string parentName, int index)
|
public static string CreateIndexModelName(string parentName, int index)
|
||||||
{
|
{
|
||||||
return CreateIndexModelName(parentName, index.ToString(CultureInfo.InvariantCulture));
|
return CreateIndexModelName(parentName, index.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create an index model name from the parent name.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parentName">The parent name.</param>
|
||||||
|
/// <param name="index">The index.</param>
|
||||||
|
/// <returns>The index model name.</returns>
|
||||||
public static string CreateIndexModelName(string parentName, string index)
|
public static string CreateIndexModelName(string parentName, string index)
|
||||||
{
|
{
|
||||||
return (parentName.Length == 0) ? "[" + index + "]" : parentName + "[" + index + "]";
|
return (parentName.Length == 0) ? "[" + index + "]" : parentName + "[" + index + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create an property model name with a prefix.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prefix">The prefix to use.</param>
|
||||||
|
/// <param name="propertyName">The property name.</param>
|
||||||
|
/// <returns>The property model name.</returns>
|
||||||
public static string CreatePropertyModelName(string prefix, string propertyName)
|
public static string CreatePropertyModelName(string prefix, string propertyName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(prefix))
|
if (string.IsNullOrEmpty(prefix))
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
private readonly ICollection<string> _originalValues;
|
private readonly ICollection<string> _originalValues;
|
||||||
private readonly string[] _sortedValues;
|
private readonly string[] _sortedValues;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="PrefixContainer"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="values">The values for the container.</param>
|
||||||
public PrefixContainer(ICollection<string> values)
|
public PrefixContainer(ICollection<string> values)
|
||||||
{
|
{
|
||||||
if (values == null)
|
if (values == null)
|
||||||
|
|
@ -40,6 +44,11 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if a prefix is in the container.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prefix">The prefix to check.</param>
|
||||||
|
/// <returns>True if the prefix is present.</returns>
|
||||||
public bool ContainsPrefix(string prefix)
|
public bool ContainsPrefix(string prefix)
|
||||||
{
|
{
|
||||||
if (prefix == null)
|
if (prefix == null)
|
||||||
|
|
@ -60,10 +69,17 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
return BinarySearch(prefix) > -1;
|
return BinarySearch(prefix) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given "foo.bar", "foo.hello", "something.other", foo[abc].baz and asking for prefix "foo" will return:
|
/// <summary>
|
||||||
// - "bar"/"foo.bar"
|
/// Gets the keys from a prefix.
|
||||||
// - "hello"/"foo.hello"
|
/// </summary>
|
||||||
// - "abc"/"foo[abc]"
|
/// <remarks>
|
||||||
|
/// Given "foo.bar", "foo.hello", "something.other", foo[abc].baz and asking for prefix "foo" will return:
|
||||||
|
/// - "bar"/"foo.bar"
|
||||||
|
/// - "hello"/"foo.hello"
|
||||||
|
/// - "abc"/"foo[abc]"
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="prefix">The prefix to enumerate.</param>
|
||||||
|
/// <returns>The keys for the prefix.</returns>
|
||||||
public IDictionary<string, string> GetKeysFromPrefix(string prefix)
|
public IDictionary<string, string> GetKeysFromPrefix(string prefix)
|
||||||
{
|
{
|
||||||
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,14 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
Culture = culture;
|
Culture = culture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The culture for the provider.
|
||||||
|
/// </summary>
|
||||||
public CultureInfo Culture { get; }
|
public CultureInfo Culture { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="PrefixContainer"/>.
|
||||||
|
/// </summary>
|
||||||
protected PrefixContainer PrefixContainer
|
protected PrefixContainer PrefixContainer
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,9 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
Culture = culture;
|
Culture = culture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The prefix container.
|
||||||
|
/// </summary>
|
||||||
protected PrefixContainer PrefixContainer
|
protected PrefixContainer PrefixContainer
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -69,6 +72,9 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The culture to use.
|
||||||
|
/// </summary>
|
||||||
protected CultureInfo Culture { get; }
|
protected CultureInfo Culture { get; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,19 @@ using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Cache for <see cref="IClientModelValidator"/>s.
|
||||||
|
/// </summary>
|
||||||
public class ClientValidatorCache
|
public class ClientValidatorCache
|
||||||
{
|
{
|
||||||
private readonly ConcurrentDictionary<ModelMetadata, CacheEntry> _cacheEntries = new ConcurrentDictionary<ModelMetadata, CacheEntry>();
|
private readonly ConcurrentDictionary<ModelMetadata, CacheEntry> _cacheEntries = new ConcurrentDictionary<ModelMetadata, CacheEntry>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the <see cref="IClientModelValidator"/> for the metadata from the cache, using the validatorProvider to create when needed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="metadata">The <see cref="ModelMetadata"/> being validated.</param>
|
||||||
|
/// <param name="validatorProvider">The <see cref="IClientModelValidatorProvider"/> which will be used to create validators when needed.</param>
|
||||||
|
/// <returns>The list of <see cref="IClientModelValidator"/>s.</returns>
|
||||||
public IReadOnlyList<IClientModelValidator> GetValidators(ModelMetadata metadata, IClientModelValidatorProvider validatorProvider)
|
public IReadOnlyList<IClientModelValidator> GetValidators(ModelMetadata metadata, IClientModelValidatorProvider validatorProvider)
|
||||||
{
|
{
|
||||||
if (metadata.MetadataKind == ModelMetadataKind.Property &&
|
if (metadata.MetadataKind == ModelMetadataKind.Property &&
|
||||||
|
|
|
||||||
|
|
@ -59,18 +59,59 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
_currentPath = new ValidationStack();
|
_currentPath = new ValidationStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The model validator provider.
|
||||||
|
/// </summary>
|
||||||
protected IModelValidatorProvider ValidatorProvider { get; }
|
protected IModelValidatorProvider ValidatorProvider { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The model metadata provider.
|
||||||
|
/// </summary>
|
||||||
protected IModelMetadataProvider MetadataProvider { get; }
|
protected IModelMetadataProvider MetadataProvider { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The validator cache.
|
||||||
|
/// </summary>
|
||||||
protected ValidatorCache Cache { get; }
|
protected ValidatorCache Cache { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The action context.
|
||||||
|
/// </summary>
|
||||||
protected ActionContext Context { get; }
|
protected ActionContext Context { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The model state.
|
||||||
|
/// </summary>
|
||||||
protected ModelStateDictionary ModelState { get; }
|
protected ModelStateDictionary ModelState { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The validation state.
|
||||||
|
/// </summary>
|
||||||
protected ValidationStateDictionary ValidationState { get; }
|
protected ValidationStateDictionary ValidationState { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The container.
|
||||||
|
/// </summary>
|
||||||
protected object Container { get; set; }
|
protected object Container { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The key.
|
||||||
|
/// </summary>
|
||||||
protected string Key { get; set; }
|
protected string Key { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The model.
|
||||||
|
/// </summary>
|
||||||
protected object Model { get; set; }
|
protected object Model { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The model metadata.
|
||||||
|
/// </summary>
|
||||||
protected ModelMetadata Metadata { get; set; }
|
protected ModelMetadata Metadata { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The validation strategy.
|
||||||
|
/// </summary>
|
||||||
protected IValidationStrategy Strategy { get; set; }
|
protected IValidationStrategy Strategy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -234,6 +275,14 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate something in a model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="metadata">The model metadata.</param>
|
||||||
|
/// <param name="key">The key to validate.</param>
|
||||||
|
/// <param name="model">The model to validate.</param>
|
||||||
|
/// <see langword="true"/> if the specified model key is valid, otherwise <see langword="false"/>.
|
||||||
|
/// <returns>Whether the the specified model key is valid.</returns>
|
||||||
protected virtual bool Visit(ModelMetadata metadata, string key, object model)
|
protected virtual bool Visit(ModelMetadata metadata, string key, object model)
|
||||||
{
|
{
|
||||||
RuntimeHelpers.EnsureSufficientExecutionStack();
|
RuntimeHelpers.EnsureSufficientExecutionStack();
|
||||||
|
|
@ -338,7 +387,11 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Covers everything VisitSimpleType does not i.e. both enumerations and complex types.
|
/// <summary>
|
||||||
|
/// Validate complex types, this covers everything VisitSimpleType does not i.e. both enumerations and complex types.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="defaultStrategy">The default validation strategy to use.</param>
|
||||||
|
/// <returns><see langword="true" /> if valid, otherwise <see langword="false" />.</returns>
|
||||||
protected virtual bool VisitComplexType(IValidationStrategy defaultStrategy)
|
protected virtual bool VisitComplexType(IValidationStrategy defaultStrategy)
|
||||||
{
|
{
|
||||||
var isValid = true;
|
var isValid = true;
|
||||||
|
|
@ -366,6 +419,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate a simple type.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if valie.</returns>
|
||||||
protected virtual bool VisitSimpleType()
|
protected virtual bool VisitSimpleType()
|
||||||
{
|
{
|
||||||
if (ModelState.HasReachedMaxErrors)
|
if (ModelState.HasReachedMaxErrors)
|
||||||
|
|
@ -377,6 +434,11 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
return ValidateNode();
|
return ValidateNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate all the child nodes using the specified strategy.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="strategy">The validation strategy.</param>
|
||||||
|
/// <returns><see langword="true" /> if all children are valid, otherwise <see langword="false" />.</returns>
|
||||||
protected virtual bool VisitChildren(IValidationStrategy strategy)
|
protected virtual bool VisitChildren(IValidationStrategy strategy)
|
||||||
{
|
{
|
||||||
var isValid = true;
|
var isValid = true;
|
||||||
|
|
@ -400,6 +462,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Supress validation for a given key.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The key to supress.</param>
|
||||||
protected virtual void SuppressValidation(string key)
|
protected virtual void SuppressValidation(string key)
|
||||||
{
|
{
|
||||||
if (key == null)
|
if (key == null)
|
||||||
|
|
@ -419,6 +485,11 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the validation entry for the model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model">The model.</param>
|
||||||
|
/// <returns>The validation state entry for the model.</returns>
|
||||||
protected virtual ValidationStateEntry GetValidationEntry(object model)
|
protected virtual ValidationStateEntry GetValidationEntry(object model)
|
||||||
{
|
{
|
||||||
if (model == null || ValidationState == null)
|
if (model == null || ValidationState == null)
|
||||||
|
|
@ -430,6 +501,9 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// State manager used for by <see cref="ValidationVisitor"/>.
|
||||||
|
/// </summary>
|
||||||
protected readonly struct StateManager : IDisposable
|
protected readonly struct StateManager : IDisposable
|
||||||
{
|
{
|
||||||
private readonly ValidationVisitor _visitor;
|
private readonly ValidationVisitor _visitor;
|
||||||
|
|
@ -439,6 +513,15 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
private readonly object _model;
|
private readonly object _model;
|
||||||
private readonly IValidationStrategy _strategy;
|
private readonly IValidationStrategy _strategy;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set up a state manager from a visitor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitor">The visitor.</param>
|
||||||
|
/// <param name="key">The key.</param>
|
||||||
|
/// <param name="metadata">The metadata.</param>
|
||||||
|
/// <param name="model">The model.</param>
|
||||||
|
/// <param name="strategy">The strategy.</param>
|
||||||
|
/// <returns>A StateManager setup for recursion.</returns>
|
||||||
public static StateManager Recurse(
|
public static StateManager Recurse(
|
||||||
ValidationVisitor visitor,
|
ValidationVisitor visitor,
|
||||||
string key,
|
string key,
|
||||||
|
|
@ -457,6 +540,11 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
return recursifier;
|
return recursifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize a new <see cref="StateManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visitor">The visitor.</param>
|
||||||
|
/// <param name="newModel">The model to validate.</param>
|
||||||
public StateManager(ValidationVisitor visitor, object newModel)
|
public StateManager(ValidationVisitor visitor, object newModel)
|
||||||
{
|
{
|
||||||
_visitor = visitor;
|
_visitor = visitor;
|
||||||
|
|
@ -468,6 +556,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
_strategy = _visitor.Strategy;
|
_strategy = _visitor.Strategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_visitor.Container = _container;
|
_visitor.Container = _container;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -8,10 +8,19 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A cache for <see cref="IModelValidator"/>
|
||||||
|
/// </summary>
|
||||||
public class ValidatorCache
|
public class ValidatorCache
|
||||||
{
|
{
|
||||||
private readonly ConcurrentDictionary<ModelMetadata, CacheEntry> _cacheEntries = new ConcurrentDictionary<ModelMetadata, CacheEntry>();
|
private readonly ConcurrentDictionary<ModelMetadata, CacheEntry> _cacheEntries = new ConcurrentDictionary<ModelMetadata, CacheEntry>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the validators for a model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="metadata">The model metadata.</param>
|
||||||
|
/// <param name="validatorProvider">The validator provider.</param>
|
||||||
|
/// <returns>A list of model validators.</returns>
|
||||||
public IReadOnlyList<IModelValidator> GetValidators(ModelMetadata metadata, IModelValidatorProvider validatorProvider)
|
public IReadOnlyList<IModelValidator> GetValidators(ModelMetadata metadata, IModelValidatorProvider validatorProvider)
|
||||||
{
|
{
|
||||||
if (_cacheEntries.TryGetValue(metadata, out var entry))
|
if (_cacheEntries.TryGetValue(metadata, out var entry))
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,18 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc
|
namespace Microsoft.AspNetCore.Mvc
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="ActionResult"/> that on execution will write an object to the response
|
||||||
|
/// using mechanisms provided by the host.
|
||||||
|
/// </summary>
|
||||||
public class ObjectResult : ActionResult, IStatusCodeActionResult
|
public class ObjectResult : ActionResult, IStatusCodeActionResult
|
||||||
{
|
{
|
||||||
private MediaTypeCollection _contentTypes;
|
private MediaTypeCollection _contentTypes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="ObjectResult"/> instance with the provided <paramref name="value"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
public ObjectResult(object value)
|
public ObjectResult(object value)
|
||||||
{
|
{
|
||||||
Value = value;
|
Value = value;
|
||||||
|
|
@ -20,17 +28,29 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
_contentTypes = new MediaTypeCollection();
|
_contentTypes = new MediaTypeCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The object result.
|
||||||
|
/// </summary>
|
||||||
[ActionResultObjectValue]
|
[ActionResultObjectValue]
|
||||||
public object Value { get; set; }
|
public object Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The collection of <see cref="IOutputFormatter"/>.
|
||||||
|
/// </summary>
|
||||||
public FormatterCollection<IOutputFormatter> Formatters { get; set; }
|
public FormatterCollection<IOutputFormatter> Formatters { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the <see cref="MediaTypeCollection"/>.
|
||||||
|
/// </summary>
|
||||||
public MediaTypeCollection ContentTypes
|
public MediaTypeCollection ContentTypes
|
||||||
{
|
{
|
||||||
get => _contentTypes;
|
get => _contentTypes;
|
||||||
set => _contentTypes = value ?? throw new ArgumentNullException(nameof(value));
|
set => _contentTypes = value ?? throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the declared type.
|
||||||
|
/// </summary>
|
||||||
public Type DeclaredType { get; set; }
|
public Type DeclaredType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -38,6 +58,7 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? StatusCode { get; set; }
|
public int? StatusCode { get; set; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override Task ExecuteResultAsync(ActionContext context)
|
public override Task ExecuteResultAsync(ActionContext context)
|
||||||
{
|
{
|
||||||
var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<ObjectResult>>();
|
var executor = context.HttpContext.RequestServices.GetRequiredService<IActionResultExecutor<ObjectResult>>();
|
||||||
|
|
@ -72,4 +93,4 @@ namespace Microsoft.AspNetCore.Mvc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,14 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Routing
|
namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface that exposes a list of http methods that are supported by an provider.
|
||||||
|
/// </summary>
|
||||||
public interface IActionHttpMethodProvider
|
public interface IActionHttpMethodProvider
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The list of http methods this action provider supports.
|
||||||
|
/// </summary>
|
||||||
IEnumerable<string> HttpMethods { get; }
|
IEnumerable<string> HttpMethods { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,18 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Routing
|
namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="IRouteConstraint"/> that represents a known route value.
|
||||||
|
/// </summary>
|
||||||
public class KnownRouteValueConstraint : IRouteConstraint
|
public class KnownRouteValueConstraint : IRouteConstraint
|
||||||
{
|
{
|
||||||
private readonly IActionDescriptorCollectionProvider _actionDescriptorCollectionProvider;
|
private readonly IActionDescriptorCollectionProvider _actionDescriptorCollectionProvider;
|
||||||
private RouteValuesCollection _cachedValuesCollection;
|
private RouteValuesCollection _cachedValuesCollection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes an instance of <see cref="KnownRouteValueConstraint"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="actionDescriptorCollectionProvider">The <see cref="IActionDescriptorCollectionProvider"/>.</param>
|
||||||
public KnownRouteValueConstraint(IActionDescriptorCollectionProvider actionDescriptorCollectionProvider)
|
public KnownRouteValueConstraint(IActionDescriptorCollectionProvider actionDescriptorCollectionProvider)
|
||||||
{
|
{
|
||||||
if (actionDescriptorCollectionProvider == null)
|
if (actionDescriptorCollectionProvider == null)
|
||||||
|
|
@ -28,6 +35,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
_actionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
|
_actionDescriptorCollectionProvider = actionDescriptorCollectionProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public bool Match(
|
public bool Match(
|
||||||
HttpContext httpContext,
|
HttpContext httpContext,
|
||||||
IRouter route,
|
IRouter route,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ using Microsoft.AspNetCore.Routing;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Routing
|
namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An abstraction for <see cref="IUrlHelper" />.
|
||||||
|
/// </summary>
|
||||||
public abstract class UrlHelperBase : IUrlHelper
|
public abstract class UrlHelperBase : IUrlHelper
|
||||||
{
|
{
|
||||||
// Perf: Share the StringBuilder object across multiple calls of GenerateURL for this UrlHelper
|
// Perf: Share the StringBuilder object across multiple calls of GenerateURL for this UrlHelper
|
||||||
|
|
@ -20,6 +23,10 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
// Perf: Reuse the RouteValueDictionary across multiple calls of Action for this UrlHelper
|
// Perf: Reuse the RouteValueDictionary across multiple calls of Action for this UrlHelper
|
||||||
private readonly RouteValueDictionary _routeValueDictionary;
|
private readonly RouteValueDictionary _routeValueDictionary;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes an instance of a <see cref="UrlHelperBase"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="actionContext">The <see cref="ActionContext"/>.</param>
|
||||||
protected UrlHelperBase(ActionContext actionContext)
|
protected UrlHelperBase(ActionContext actionContext)
|
||||||
{
|
{
|
||||||
if (actionContext == null)
|
if (actionContext == null)
|
||||||
|
|
@ -101,7 +108,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual string Content(string contentPath)
|
public virtual string Content(string contentPath)
|
||||||
{
|
{
|
||||||
|
|
@ -138,6 +144,11 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public abstract string RouteUrl(UrlRouteContext routeContext);
|
public abstract string RouteUrl(UrlRouteContext routeContext);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a <see cref="RouteValueDictionary"/> using the specified values.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="values">The values to use.</param>
|
||||||
|
/// <returns>A <see cref="RouteValueDictionary"/> with the specified values.</returns>
|
||||||
protected RouteValueDictionary GetValuesDictionary(object values)
|
protected RouteValueDictionary GetValuesDictionary(object values)
|
||||||
{
|
{
|
||||||
// Perf: RouteValueDictionary can be cast to IDictionary<string, object>, but it is
|
// Perf: RouteValueDictionary can be cast to IDictionary<string, object>, but it is
|
||||||
|
|
@ -167,6 +178,14 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
||||||
return new RouteValueDictionary(values);
|
return new RouteValueDictionary(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate a url using the specified values.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="protocol">The protocol.</param>
|
||||||
|
/// <param name="host">The host.</param>
|
||||||
|
/// <param name="virtualPath">The virtual path.</param>
|
||||||
|
/// <param name="fragment">The fragment.</param>
|
||||||
|
/// <returns>The generated url</returns>
|
||||||
protected string GenerateUrl(string protocol, string host, string virtualPath, string fragment)
|
protected string GenerateUrl(string protocol, string host, string virtualPath, string fragment)
|
||||||
{
|
{
|
||||||
if (virtualPath == null)
|
if (virtualPath == null)
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ using Microsoft.AspNetCore.Routing;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc
|
namespace Microsoft.AspNetCore.Mvc
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class for url helper extension methods.
|
||||||
|
/// </summary>
|
||||||
public static class UrlHelperExtensions
|
public static class UrlHelperExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC cross-origin resource sharing (CORS) features.</Description>
|
<Description>ASP.NET Core MVC cross-origin resource sharing (CORS) features.</Description>
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc;cors</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc;cors</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC metadata and validation system using System.ComponentModel.DataAnnotations.</Description>
|
<Description>ASP.NET Core MVC metadata and validation system using System.ComponentModel.DataAnnotations.</Description>
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC formatters for JSON input and output.</Description>
|
<Description>ASP.NET Core MVC formatters for JSON input and output.</Description>
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc;json</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc;json</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC formatters for XML input and output using DataContractSerializer and XmlSerializer.</Description>
|
<Description>ASP.NET Core MVC formatters for XML input and output using DataContractSerializer and XmlSerializer.</Description>
|
||||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||||
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
<IsAspNetCoreApp>true</IsAspNetCoreApp>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc;xml</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc;xml</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
|
||||||
// other ModelState entries because the character is not legal in an expression name.
|
// other ModelState entries because the character is not legal in an expression name.
|
||||||
internal static readonly string EmptyKey = "MVC-Empty";
|
internal static readonly string EmptyKey = "MVC-Empty";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new <see cref="SerializableErrorWrapper"/>
|
||||||
|
/// </summary>
|
||||||
// Note: XmlSerializer requires to have default constructor
|
// Note: XmlSerializer requires to have default constructor
|
||||||
public SerializableErrorWrapper()
|
public SerializableErrorWrapper()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC features that enable globalization and localization of applications.
|
<Description>ASP.NET Core MVC features that enable globalization and localization of applications.
|
||||||
|
|
@ -10,6 +10,7 @@ Microsoft.AspNetCore.Mvc.Localization.IViewLocalizer</Description>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc;localization</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc;localization</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH.</Description>
|
<Description>ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH.</Description>
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc;json</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc;json</PackageTags>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<DefineConstants>$(DefineConstants);JSONNET</DefineConstants>
|
<DefineConstants>$(DefineConstants);JSONNET</DefineConstants>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -8,6 +8,9 @@ using Microsoft.Extensions.DependencyModel;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.ApplicationParts
|
namespace Microsoft.AspNetCore.Mvc.ApplicationParts
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class that adds methods to <see cref="AssemblyPart"/>.
|
||||||
|
/// </summary>
|
||||||
public static class AssemblyPartExtensions
|
public static class AssemblyPartExtensions
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyInjection
|
namespace Microsoft.Extensions.DependencyInjection
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class that adds razor compilation extenstion methods.
|
||||||
|
/// </summary>
|
||||||
public static class RazorRuntimeCompilationMvcBuilderExtensions
|
public static class RazorRuntimeCompilationMvcBuilderExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyInjection
|
namespace Microsoft.Extensions.DependencyInjection
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class that adds razor runtime compilation extension methods.
|
||||||
|
/// </summary>
|
||||||
public static class RazorRuntimeCompilationMvcCoreBuilderExtensions
|
public static class RazorRuntimeCompilationMvcCoreBuilderExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -8,16 +8,34 @@ using Microsoft.Extensions.FileProviders;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A file provider <see cref="RazorProjectItem"/>.
|
||||||
|
/// </summary>
|
||||||
public class FileProviderRazorProjectItem : RazorProjectItem
|
public class FileProviderRazorProjectItem : RazorProjectItem
|
||||||
{
|
{
|
||||||
private string _root;
|
private string _root;
|
||||||
private string _relativePhysicalPath;
|
private string _relativePhysicalPath;
|
||||||
private bool _isRelativePhysicalPathSet;
|
private bool _isRelativePhysicalPathSet;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Intializes a new instance of a <see cref="FileProviderRazorProjectItem"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileInfo">The file info.</param>
|
||||||
|
/// <param name="basePath">The base path.</param>
|
||||||
|
/// <param name="filePath">The file path.</param>
|
||||||
|
/// <param name="root">The root.</param>
|
||||||
public FileProviderRazorProjectItem(IFileInfo fileInfo, string basePath, string filePath, string root) : this(fileInfo, basePath, filePath, root, fileKind: null)
|
public FileProviderRazorProjectItem(IFileInfo fileInfo, string basePath, string filePath, string root) : this(fileInfo, basePath, filePath, root, fileKind: null)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Intializes a new instance of a <see cref="FileProviderRazorProjectItem"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fileInfo">The file info.</param>
|
||||||
|
/// <param name="basePath">The base path.</param>
|
||||||
|
/// <param name="filePath">The file path.</param>
|
||||||
|
/// <param name="root">The root.</param>
|
||||||
|
/// <param name="fileKind">The kind of file.</param>
|
||||||
public FileProviderRazorProjectItem(IFileInfo fileInfo, string basePath, string filePath, string root, string fileKind)
|
public FileProviderRazorProjectItem(IFileInfo fileInfo, string basePath, string filePath, string root, string fileKind)
|
||||||
{
|
{
|
||||||
FileInfo = fileInfo;
|
FileInfo = fileInfo;
|
||||||
|
|
@ -27,18 +45,27 @@ namespace Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
|
||||||
_root = root;
|
_root = root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="IFileInfo"/>.
|
||||||
|
/// </summary>
|
||||||
public IFileInfo FileInfo { get; }
|
public IFileInfo FileInfo { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override string BasePath { get; }
|
public override string BasePath { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override string FilePath { get; }
|
public override string FilePath { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override string FileKind { get; }
|
public override string FileKind { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override bool Exists => FileInfo.Exists;
|
public override bool Exists => FileInfo.Exists;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override string PhysicalPath => FileInfo.PhysicalPath;
|
public override string PhysicalPath => FileInfo.PhysicalPath;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override string RelativePhysicalPath
|
public override string RelativePhysicalPath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -64,9 +91,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
public override Stream Read()
|
public override Stream Read()
|
||||||
{
|
{
|
||||||
return FileInfo.CreateReadStream();
|
return FileInfo.CreateReadStream();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Runtime compilation support for Razor views and Razor Pages in ASP.NET Core MVC.</Description>
|
<Description>Runtime compilation support for Razor views and Razor Pages in ASP.NET Core MVC.</Description>
|
||||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc;razor</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc;razor</PackageTags>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -8,6 +8,9 @@ using Microsoft.Extensions.FileProviders;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Used to configure razor compilation.
|
||||||
|
/// </summary>
|
||||||
public class MvcRazorRuntimeCompilationOptions
|
public class MvcRazorRuntimeCompilationOptions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,20 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a view compiler.
|
||||||
|
/// </summary>
|
||||||
public interface IViewCompiler
|
public interface IViewCompiler
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Compile a view at the specified path.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="relativePath">The relative path to the view.</param>
|
||||||
|
/// <returns>A <see cref="CompiledViewDescriptor"/>.</returns>
|
||||||
Task<CompiledViewDescriptor> CompileAsync(string relativePath);
|
Task<CompiledViewDescriptor> CompileAsync(string relativePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a <see cref="IViewCompiler"/>.
|
||||||
|
/// </summary>
|
||||||
public interface IViewCompilerProvider
|
public interface IViewCompilerProvider
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a <see cref="IViewCompiler"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The view compiler.</returns>
|
||||||
IViewCompiler GetCompiler();
|
IViewCompiler GetCompiler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,22 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This class is replaced by RazorCompiledItem and will not be used by the runtime.
|
||||||
|
/// </summary>
|
||||||
[Obsolete("This attribute has been superseded by RazorCompiledItem and will not be used by the runtime.")]
|
[Obsolete("This attribute has been superseded by RazorCompiledItem and will not be used by the runtime.")]
|
||||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
public class RazorViewAttribute : Attribute
|
public class RazorViewAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This class is replaced by RazorCompiledItem and will not be used by the runtime.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">The path.</param>
|
||||||
|
/// <param name="viewType">The viewtype.</param>
|
||||||
public RazorViewAttribute(string path, Type viewType)
|
public RazorViewAttribute(string path, Type viewType)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,18 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A feature that contains view descriptors.
|
||||||
|
/// </summary>
|
||||||
public class ViewsFeature
|
public class ViewsFeature
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A list of <see cref="CompiledViewDescriptor"/>.
|
||||||
|
/// </summary>
|
||||||
public IList<CompiledViewDescriptor> ViewDescriptors { get; } = new List<CompiledViewDescriptor>();
|
public IList<CompiledViewDescriptor> ViewDescriptors { get; } = new List<CompiledViewDescriptor>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,16 @@ using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyInjection
|
namespace Microsoft.Extensions.DependencyInjection
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Static class that adds RazorViewEngine methods to <see cref="IMvcCoreBuilder"/>.
|
||||||
|
/// </summary>
|
||||||
public static class MvcRazorMvcCoreBuilderExtensions
|
public static class MvcRazorMvcCoreBuilderExtensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Registers Razor view engine services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IMvcCoreBuilder"/>.</param>
|
||||||
|
/// <returns>The <see cref="IMvcCoreBuilder"/>.</returns>
|
||||||
public static IMvcCoreBuilder AddRazorViewEngine(this IMvcCoreBuilder builder)
|
public static IMvcCoreBuilder AddRazorViewEngine(this IMvcCoreBuilder builder)
|
||||||
{
|
{
|
||||||
if (builder == null)
|
if (builder == null)
|
||||||
|
|
@ -33,6 +41,12 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers Razor view engine services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IMvcCoreBuilder"/>.</param>
|
||||||
|
/// <param name="setupAction">A setup action that configures the <see cref="RazorViewEngineOptions"/>.</param>
|
||||||
|
/// <returns>The <see cref="IMvcCoreBuilder"/>.</returns>
|
||||||
public static IMvcCoreBuilder AddRazorViewEngine(
|
public static IMvcCoreBuilder AddRazorViewEngine(
|
||||||
this IMvcCoreBuilder builder,
|
this IMvcCoreBuilder builder,
|
||||||
Action<RazorViewEngineOptions> setupAction)
|
Action<RazorViewEngineOptions> setupAction)
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,25 @@ using Microsoft.AspNetCore.Mvc.Rendering;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="EventData"/> that occurs before a view page.
|
||||||
|
/// </summary>
|
||||||
public sealed class BeforeViewPageEventData : EventData
|
public sealed class BeforeViewPageEventData : EventData
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the event.
|
||||||
|
/// </summary>
|
||||||
public const string EventName = EventNamespace +
|
public const string EventName = EventNamespace +
|
||||||
"Razor." +
|
"Razor." +
|
||||||
"BeforeViewPage";
|
"BeforeViewPage";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="BeforeViewPageEventData"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="page">The page.</param>
|
||||||
|
/// <param name="viewContext">The view context.</param>
|
||||||
|
/// <param name="actionDescriptor">The action.</param>
|
||||||
|
/// <param name="httpContext">The http context.</param>
|
||||||
public BeforeViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
|
public BeforeViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
|
||||||
{
|
{
|
||||||
Page = page;
|
Page = page;
|
||||||
|
|
@ -24,13 +37,30 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
HttpContext = httpContext;
|
HttpContext = httpContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="IRazorPage"/>.
|
||||||
|
/// </summary>
|
||||||
public IRazorPage Page { get; }
|
public IRazorPage Page { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ViewContext"/>.
|
||||||
|
/// </summary>
|
||||||
public ViewContext ViewContext { get; }
|
public ViewContext ViewContext { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ActionDescriptor"/>.
|
||||||
|
/// </summary>
|
||||||
public ActionDescriptor ActionDescriptor { get; }
|
public ActionDescriptor ActionDescriptor { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="HttpContext"/>.
|
||||||
|
/// </summary>
|
||||||
public HttpContext HttpContext { get; }
|
public HttpContext HttpContext { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected override int Count => 4;
|
protected override int Count => 4;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected override KeyValuePair<string, object> this[int index] => index switch
|
protected override KeyValuePair<string, object> this[int index] => index switch
|
||||||
{
|
{
|
||||||
0 => new KeyValuePair<string, object>(nameof(Page), Page),
|
0 => new KeyValuePair<string, object>(nameof(Page), Page),
|
||||||
|
|
@ -41,12 +71,25 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An <see cref="EventData"/> that occurs after a view page.
|
||||||
|
/// </summary>
|
||||||
public sealed class AfterViewPageEventData : EventData
|
public sealed class AfterViewPageEventData : EventData
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The name of the event.
|
||||||
|
/// </summary>
|
||||||
public const string EventName = EventNamespace +
|
public const string EventName = EventNamespace +
|
||||||
"Razor." +
|
"Razor." +
|
||||||
"AfterViewPage";
|
"AfterViewPage";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of <see cref="AfterViewPageEventData"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="page">The page.</param>
|
||||||
|
/// <param name="viewContext">The view context.</param>
|
||||||
|
/// <param name="actionDescriptor">The action.</param>
|
||||||
|
/// <param name="httpContext">The http context.</param>
|
||||||
public AfterViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
|
public AfterViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext)
|
||||||
{
|
{
|
||||||
Page = page;
|
Page = page;
|
||||||
|
|
@ -55,13 +98,30 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
HttpContext = httpContext;
|
HttpContext = httpContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="IRazorPage"/>.
|
||||||
|
/// </summary>
|
||||||
public IRazorPage Page { get; }
|
public IRazorPage Page { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ViewContext"/>.
|
||||||
|
/// </summary>
|
||||||
public ViewContext ViewContext { get; }
|
public ViewContext ViewContext { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ActionDescriptor"/>.
|
||||||
|
/// </summary>
|
||||||
public ActionDescriptor ActionDescriptor { get; }
|
public ActionDescriptor ActionDescriptor { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="HttpContext"/>.
|
||||||
|
/// </summary>
|
||||||
public HttpContext HttpContext { get; }
|
public HttpContext HttpContext { get; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected override int Count => 4;
|
protected override int Count => 4;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
protected override KeyValuePair<string, object> this[int index] => index switch
|
protected override KeyValuePair<string, object> this[int index] => index switch
|
||||||
{
|
{
|
||||||
0 => new KeyValuePair<string, object>(nameof(Page), Page),
|
0 => new KeyValuePair<string, object>(nameof(Page), Page),
|
||||||
|
|
@ -71,4 +131,4 @@ namespace Microsoft.AspNetCore.Mvc.Diagnostics
|
||||||
_ => throw new IndexOutOfRangeException(nameof(index))
|
_ => throw new IndexOutOfRangeException(nameof(index))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core MVC Razor view engine for CSHTML files.</Description>
|
<Description>ASP.NET Core MVC Razor view engine for CSHTML files.</Description>
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;aspnetcoremvc;cshtml;razor</PackageTags>
|
<PackageTags>aspnetcore;aspnetcoremvc;cshtml;razor</PackageTags>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue