Implements directory browser dialog, part 6: hidden file system items toggle

This commit is contained in:
BinaryAlley committed 2024-09-24 11:10:03 +03:00
1 parent cd44f11d9e
commit debad9ef74
74 files changed
+596 -427

No files matched your search

@@ -2,6 +2,8 @@
using ErrorOr;
using FluentValidation;
using Mediator;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading;
using System.Threading.Tasks;
#endregion
@@ -49,7 +51,7 @@ public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TReques
if (validationResult.IsValid)
return await next(request, cancellationToken).ConfigureAwait(false);
// after the command handler is executed
System.Collections.Generic.List<Error> errors = validationResult.Errors.ConvertAll(validationFailure => Error.Validation(description: validationFailure.ErrorMessage));
List<Error> errors = validationResult.Errors.ConvertAll(validationFailure => Error.Validation(description: validationFailure.ErrorMessage));
// the compiler doesn't know there is an implicit converter from a list of errors to the ErrorOr object, and unfortunately, there is no way around this but to use some magic
// this is acceptable because we DO know that we will always have a list of errors of type ErrorOr (check the generic constraint at the top of the class!)
return (dynamic)errors;
@@ -23,7 +23,10 @@ public static class ApplicationLayerServices
public static IServiceCollection AddApplicationLayerServices(this IServiceCollection services)
{
// register Mediator
services.AddMediator(options => options.ServiceLifetime = ServiceLifetime.Scoped);
services.AddMediator(options =>
{
options.ServiceLifetime = ServiceLifetime.Scoped;
});
// register the validation behavior
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));