File tree Expand file tree Collapse file tree
Inventory/Ecommerce.Modules.Inventory.Application
Orders/Ecommerce.Modules.Orders.Application Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,21 +16,19 @@ namespace Ecommerce.Modules.Inventory.Application
1616{
1717 public static class Extensions
1818 {
19- private const string _sieveSectionName = "Sieve" ;
2019 public static IServiceCollection AddApplication ( this IServiceCollection services , IConfiguration configuration )
2120 {
21+ services . Scan ( i => i . FromAssemblies ( Assembly . GetExecutingAssembly ( ) )
22+ . AddClasses ( c => c . AssignableTo ( typeof ( IValidator < > ) ) )
23+ . AsImplementedInterfaces ( )
24+ . WithScopedLifetime ( ) ) ;
2225 services . AddMediatR ( cfg =>
2326 {
2427 cfg . AddOpenBehavior ( typeof ( InventoryValidationBehavior < , > ) ) ;
2528 cfg . AddOpenBehavior ( typeof ( InventoryUnitOfWorkBehavior < , > ) ) ;
2629 cfg . RegisterServicesFromAssembly ( Assembly . GetExecutingAssembly ( ) ) ;
2730 } ) ;
2831 services . AddSingleton < IInventoryEventMapper , InventoryEventMapper > ( ) ;
29- services . Scan ( i => i . FromAssemblies ( Assembly . GetExecutingAssembly ( ) )
30- . AddClasses ( c => c . AssignableTo ( typeof ( IValidator < > ) ) )
31- . AsImplementedInterfaces ( )
32- . WithScopedLifetime ( ) ) ;
33- //services.Configure<SieveOptions>(configuration.GetSection(_sieveSectionName));
3432 return services ;
3533 }
3634 }
Original file line number Diff line number Diff line change @@ -16,17 +16,17 @@ public static class Extensions
1616 {
1717 public static IServiceCollection AddApplication ( this IServiceCollection services )
1818 {
19+ services . Scan ( i => i . FromAssemblies ( Assembly . GetExecutingAssembly ( ) )
20+ . AddClasses ( c => c . AssignableTo ( typeof ( IValidator < > ) ) )
21+ . AsImplementedInterfaces ( )
22+ . WithScopedLifetime ( ) ) ;
1923 services . AddMediatR ( cfg =>
2024 {
2125 cfg . AddOpenBehavior ( typeof ( OrdersValidationBehavior < , > ) ) ;
2226 cfg . AddOpenBehavior ( typeof ( OrdersUnitOfWorkBehavior < , > ) ) ;
2327 cfg . RegisterServicesFromAssembly ( Assembly . GetExecutingAssembly ( ) ) ;
2428 } ) ;
2529 services . AddSingleton < IOrdersEventMapper , OrdersEventMapper > ( ) ;
26- services . Scan ( i => i . FromAssemblies ( Assembly . GetExecutingAssembly ( ) )
27- . AddClasses ( c => c . AssignableTo ( typeof ( IValidator < > ) ) )
28- . AsImplementedInterfaces ( )
29- . WithScopedLifetime ( ) ) ;
3030 return services ;
3131 }
3232 }
You can’t perform that action at this time.
0 commit comments