Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit 2bd8350

Browse files
committed
Creazione nuovo metodo statico per Fluent Validation closes #25
1 parent a579854 commit 2bd8350

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/NET6CustomLibrary/Extensions/DependencyInjection.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,15 @@ public static IServiceCollection AddRedisCacheService(this IServiceCollection se
362362
return services;
363363
}
364364
#endregion
365+
366+
#region "FLUENT VALIDATION"
367+
public static IServiceCollection AddFluentValidationService<TAssembly>(this IServiceCollection services) where TAssembly : class
368+
{
369+
services.AddScoped<IValidation, Validazione.Validation>();
370+
services.AddScoped<ILoggerService, LoggerService>();
371+
services.AddValidatorsFromAssemblyContaining<TAssembly>();
372+
373+
return services;
374+
}
375+
#endregion
365376
}

src/NET6CustomLibrary/GlobalUsings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
global using System.Text.Json.Serialization;
1111
global using System.Threading;
1212
global using System.Threading.Tasks;
13+
global using FluentValidation;
1314
global using FluentValidation.Results;
1415
global using MailKit.Net.Smtp;
1516
global using MailKit.Security;
@@ -40,7 +41,6 @@
4041
global using NET6CustomLibrary.EFCore.Core.Interfaces;
4142
global using NET6CustomLibrary.EFCore.Infrastructure.Interfaces;
4243
global using NET6CustomLibrary.EFCore.Infrastructure.Repository;
43-
global using NET6CustomLibrary.Errors.Interfaces;
4444
global using NET6CustomLibrary.MailKit.Options;
4545
global using NET6CustomLibrary.MailKit.Services;
4646
global using NET6CustomLibrary.MultiLanguage;

0 commit comments

Comments
 (0)