Kleinere Änderungen, Dokumentation und Git-Dateien
This commit is contained in:
@@ -19,7 +19,10 @@
|
||||
|
||||
<PackageId>AMWD.Common.AspNetCore</PackageId>
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<PackageProjectUrl>https://git.am-wd.de/AM.WD/common</PackageProjectUrl>
|
||||
<PackageProjectUrl>https://wiki.am-wd.de/libs/common</PackageProjectUrl>
|
||||
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://git.am-wd.de/AM.WD/common.git</RepositoryUrl>
|
||||
|
||||
<Product>AM.WD Common Library for ASP.NET Core</Product>
|
||||
<Description>Library with classes and extensions used frequently on AM.WD projects.</Description>
|
||||
|
||||
@@ -14,9 +14,8 @@ namespace Microsoft.AspNetCore.Builder
|
||||
/// Adds settings to run behind a reverse proxy (e.g. NginX).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A base path (e.g. running in a sub-directory /app) for the application is defined via<br/>
|
||||
/// - <c>ASPNETCORE_APPL_PATH</c> environment variable (preferred)<br/>
|
||||
/// - <c>AspNetCore_Appl_Path</c> in the settings file<br/>
|
||||
/// A base path (e.g. running in a sub-directory /app) for the application is defined via <c>ASPNETCORE_APPL_PATH</c> environment variable.
|
||||
/// <br/>
|
||||
/// <br/>
|
||||
/// Additionally you can specify the proxy server by using <paramref name="address"/> or a <paramref name="network"/> when there are multiple proxy servers.
|
||||
/// <br/>
|
||||
|
||||
@@ -19,9 +19,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||
/// <param name="keyExpression">The <see cref="MemberExpression"/> that specifies the property.</param>
|
||||
/// <param name="errorMessage">The error message to add.</param>
|
||||
/// <exception cref="InvalidOperationException">No member expression provided.</exception>
|
||||
#pragma warning disable IDE0060 // remove unused parameters
|
||||
public static void AddModelError<TModel, TProperty>(this ModelStateDictionary modelState, TModel model, Expression<Func<TModel, TProperty>> keyExpression, string errorMessage)
|
||||
#pragma warning restore IDE0060 // remove unused parameters
|
||||
{
|
||||
if (modelState is null)
|
||||
throw new ArgumentNullException(nameof(modelState));
|
||||
|
||||
@@ -9,24 +9,24 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||
/// <summary>
|
||||
/// Custom floating point ModelBinder as the team of Microsoft is not capable of fixing their <see href="https://github.com/dotnet/aspnetcore/issues/6566">issue</see> with other cultures than en-US.
|
||||
/// </summary>
|
||||
public class CustomFloatingPointModelBinder : IModelBinder
|
||||
public class InvariantFloatingPointModelBinder : IModelBinder
|
||||
{
|
||||
private readonly NumberStyles supportedNumberStyles;
|
||||
private readonly ILogger logger;
|
||||
private readonly CultureInfo cultureInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="CustomFloatingPointModelBinder"/>.
|
||||
/// Initializes a new instance of <see cref="InvariantFloatingPointModelBinder"/>.
|
||||
/// </summary>
|
||||
/// <param name="supportedStyles">The <see cref="NumberStyles"/>.</param>
|
||||
/// <param name="cultureInfo">The <see cref="CultureInfo"/>.</param>
|
||||
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/>.</param>
|
||||
public CustomFloatingPointModelBinder(NumberStyles supportedStyles, CultureInfo cultureInfo, ILoggerFactory loggerFactory)
|
||||
public InvariantFloatingPointModelBinder(NumberStyles supportedStyles, CultureInfo cultureInfo, ILoggerFactory loggerFactory)
|
||||
{
|
||||
this.cultureInfo = cultureInfo ?? throw new ArgumentNullException(nameof(cultureInfo));
|
||||
|
||||
supportedNumberStyles = supportedStyles;
|
||||
logger = loggerFactory?.CreateLogger<CustomFloatingPointModelBinder>();
|
||||
logger = loggerFactory?.CreateLogger<InvariantFloatingPointModelBinder>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||
/// options.ModelBinderProviders.Insert(0, new CustomFloatingPointModelBinderProvider());<br/>
|
||||
/// });</code>
|
||||
/// </remarks>
|
||||
public class CustomFloatingPointModelBinderProvider : IModelBinderProvider
|
||||
public class InvariantFloatingPointModelBinderProvider : IModelBinderProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the supported <see cref="NumberStyles"/> globally.
|
||||
@@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
|
||||
modelType == typeof(double) ||
|
||||
modelType == typeof(float))
|
||||
{
|
||||
return new CustomFloatingPointModelBinder(SupportedNumberStyles, CultureInfo, loggerFactory);
|
||||
return new InvariantFloatingPointModelBinder(SupportedNumberStyles, CultureInfo, loggerFactory);
|
||||
}
|
||||
|
||||
return null;
|
||||
Reference in New Issue
Block a user