Swiches Client Web app from Blazor to ASP.NET Core MVC

This commit is contained in:
BinaryAlley committed 2024-10-02 22:19:14 +03:00
1 parent cf94676666
commit 9a7d4c607d
35 files changed
+4066 -1853

No files matched your search

@@ -28,12 +28,12 @@ public class CustomProblemDetailsFactory : ProblemDetailsFactory
/// <summary>
/// Initializes a new instance of the <see cref="CustomProblemDetailsFactory"/> class.
/// </summary>
/// <param name="options">Injected service for retrieving <see cref="ApiBehaviorOptions"/>.</param>
/// <param name="apiBehaviorOptions">Injected service for retrieving <see cref="ApiBehaviorOptions"/>.</param>
/// <param name="problemDetailsOptions">Injected service for retrieving <see cref="ProblemDetailsOptions"/>.</param>
/// <exception cref="ArgumentNullException">Thrown when the value of options (if any) is <see langword="null"/>.</exception>
public CustomProblemDetailsFactory(IOptions<ApiBehaviorOptions> options, IOptions<ProblemDetailsOptions>? problemDetailsOptions = null)
public CustomProblemDetailsFactory(IOptions<ApiBehaviorOptions> apiBehaviorOptions, IOptions<ProblemDetailsOptions>? problemDetailsOptions = null)
{
_options = options?.Value ?? throw new ArgumentNullException(nameof(options));
_options = apiBehaviorOptions?.Value ?? throw new ArgumentNullException(nameof(apiBehaviorOptions));
_configure = problemDetailsOptions?.Value?.CustomizeProblemDetails;
}
#endregion
@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System;
using System.Threading.Tasks;
@@ -19,8 +19,7 @@ public class UrlStringBinder : IModelBinder
/// <returns>A task representing the bind operation.</returns>
public Task BindModelAsync(ModelBindingContext bindingContext)
{
if (bindingContext is null)
throw new ArgumentNullException(nameof(bindingContext));
ArgumentNullException.ThrowIfNull(bindingContext);
string modelName = bindingContext.ModelName;
// try to fetch the value of the argument by name
ValueProviderResult valueProviderResult = bindingContext.ValueProvider.GetValue(modelName);
@@ -38,4 +37,4 @@ public class UrlStringBinder : IModelBinder
return Task.CompletedTask;
}
#endregion
}
}