Cleaned-up the registration of DomainEventHandlers and FluentValidation Validators
This commit is contained in:
parent
d60e130b4b
commit
b1e3bdefbe
@ -23,11 +23,11 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Autof
|
|||||||
builder.RegisterAssemblyTypes(typeof(CreateOrderCommand).GetTypeInfo().Assembly)
|
builder.RegisterAssemblyTypes(typeof(CreateOrderCommand).GetTypeInfo().Assembly)
|
||||||
.AsClosedTypesOf(typeof(IAsyncRequestHandler<,>));
|
.AsClosedTypesOf(typeof(IAsyncRequestHandler<,>));
|
||||||
|
|
||||||
// Register all the event classes (they implement IAsyncNotificationHandler) in assembly holding the Commands
|
// Register the DomainEventHandler classes (they implement IAsyncNotificationHandler<>) in assembly holding the Domain Events
|
||||||
builder.RegisterAssemblyTypes(typeof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler).GetTypeInfo().Assembly)
|
builder.RegisterAssemblyTypes(typeof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler).GetTypeInfo().Assembly)
|
||||||
.AsClosedTypesOf(typeof(IAsyncNotificationHandler<>));
|
.AsClosedTypesOf(typeof(IAsyncNotificationHandler<>));
|
||||||
|
|
||||||
|
// Register the Command's Validators (Validators based on FluentValidation library)
|
||||||
builder
|
builder
|
||||||
.RegisterAssemblyTypes(typeof(CreateOrderCommandValidator).GetTypeInfo().Assembly)
|
.RegisterAssemblyTypes(typeof(CreateOrderCommandValidator).GetTypeInfo().Assembly)
|
||||||
.Where(t => t.IsClosedTypeOf(typeof(IValidator<>)))
|
.Where(t => t.IsClosedTypeOf(typeof(IValidator<>)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user