1
0

Kleinere Änderungen, Dokumentation und Git-Dateien

This commit is contained in:
2021-10-24 16:51:17 +02:00
parent 9f9ee9469e
commit b74eb5b958
12 changed files with 187 additions and 170 deletions

View File

@@ -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 />

View File

@@ -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;