File tree Expand file tree Collapse file tree
src/Services/Ordering/Ordering.API
Infrastructure/AutofacModules Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using Autofac ;
2+ using Microsoft . eShopOnContainers . BuildingBlocks . EventBus . Abstractions ;
3+ using Microsoft . eShopOnContainers . Services . Ordering . API . Application . Commands ;
24using Microsoft . eShopOnContainers . Services . Ordering . API . Application . Queries ;
35using Microsoft . eShopOnContainers . Services . Ordering . Domain . AggregatesModel . BuyerAggregate ;
46using Microsoft . eShopOnContainers . Services . Ordering . Domain . AggregatesModel . OrderAggregate ;
57using Microsoft . eShopOnContainers . Services . Ordering . Infrastructure . Idempotency ;
68using Microsoft . eShopOnContainers . Services . Ordering . Infrastructure . Repositories ;
9+ using System . Reflection ;
710
811namespace Microsoft . eShopOnContainers . Services . Ordering . API . Infrastructure . AutofacModules
912{
@@ -38,6 +41,10 @@ protected override void Load(ContainerBuilder builder)
3841 builder . RegisterType < RequestManager > ( )
3942 . As < IRequestManager > ( )
4043 . InstancePerLifetimeScope ( ) ;
44+
45+ builder . RegisterAssemblyTypes ( typeof ( CreateOrderCommandHandler ) . GetTypeInfo ( ) . Assembly )
46+ . AsClosedTypesOf ( typeof ( IIntegrationEventHandler < > ) ) ;
47+
4148 }
4249 }
4350}
Original file line number Diff line number Diff line change @@ -21,16 +21,11 @@ protected override void Load(ContainerBuilder builder)
2121
2222 // Register all the Command classes (they implement IAsyncRequestHandler) in assembly holding the Commands
2323 builder . RegisterAssemblyTypes ( typeof ( CreateOrderCommand ) . GetTypeInfo ( ) . Assembly )
24- . As ( o => o . GetInterfaces ( )
25- . Where ( i => i . IsClosedTypeOf ( typeof ( IAsyncRequestHandler < , > ) ) )
26- . Select ( i => new KeyedService ( "IAsyncRequestHandler" , i ) ) ) ;
24+ . AsClosedTypesOf ( typeof ( IAsyncRequestHandler < , > ) ) ;
2725
2826 // Register all the event classes (they implement IAsyncNotificationHandler) in assembly holding the Commands
2927 builder . RegisterAssemblyTypes ( typeof ( ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler ) . GetTypeInfo ( ) . Assembly )
30- . As ( o => o . GetInterfaces ( )
31- . Where ( i => i . IsClosedTypeOf ( typeof ( IAsyncNotificationHandler < > ) ) )
32- . Select ( i => new KeyedService ( "IAsyncNotificationHandler" , i ) ) )
33- . AsImplementedInterfaces ( ) ;
28+ . AsClosedTypesOf ( typeof ( IAsyncNotificationHandler < > ) ) ;
3429
3530
3631 builder
Original file line number Diff line number Diff line change 3434 <ItemGroup >
3535 <PackageReference Include =" FluentValidation.AspNetCore" Version =" 7.0.3" />
3636 <PackageReference Include =" FluentValidation.MVC6" Version =" 6.4.0" />
37- <PackageReference Include =" MediatR.Extensions.Microsoft.DependencyInjection" Version =" 2 .0.0" />
37+ <PackageReference Include =" MediatR.Extensions.Microsoft.DependencyInjection" Version =" 3 .0.0" />
3838 <PackageReference Include =" Autofac.Extensions.DependencyInjection" Version =" 4.1.0" />
3939 <PackageReference Include =" Microsoft.AspNetCore.Mvc" Version =" 2.0.0" />
4040 <PackageReference Include =" Microsoft.AspNetCore.Server.IISIntegration" Version =" 2.0.0" />
Original file line number Diff line number Diff line change @@ -67,11 +67,13 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
6767 options . Filters . Add ( typeof ( HttpGlobalExceptionFilter ) ) ;
6868 } ) . AddControllersAsServices ( ) ; //Injecting Controllers themselves thru DI
6969 //For further info see: http://docs.autofac.org/en/latest/integration/aspnetcore.html#controllers-as-services
70-
70+
7171 // Configure GracePeriodManager Hosted Service
7272 services . AddSingleton < IHostedService , GracePeriodManagerService > ( ) ;
7373 services . Configure < GracePeriodManagerSettings > ( Configuration ) ;
7474
75+ services . AddTransient < IOrderingIntegrationEventService , OrderingIntegrationEventService > ( ) ;
76+
7577 services . AddHealthChecks ( checks =>
7678 {
7779 var minutes = 1 ;
You can’t perform that action at this time.
0 commit comments