Esempio n. 1
0
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddSingleton <IEventMapper, EventMapper>();
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddTransient <ICustomerRepository, CustomerMongoRepository>();
            builder.Services.AddTransient <IOrderRepository, OrderMongoRepository>();
            builder.Services.AddSingleton <IDateTimeProvider, DateTimeProvider>();
            builder.Services.AddTransient <IParcelsServiceClient, ParcelsServiceClient>();
            builder.Services.AddTransient <IPricingServiceClient, PricingServiceClient>();
            builder.Services.AddTransient <IVehiclesServiceClient, VehiclesServiceClient>();
            builder.Services.AddTransient <IAppContextFactory, AppContextFactory>();
            builder.Services.AddTransient(ctx => ctx.GetRequiredService <IAppContextFactory>().Create());

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddRabbitMq <CorrelationContext>(plugins: p => p.RegisterJaeger())
                   .AddExceptionToMessageMapper <ExceptionToMessageMapper>()
                   .AddMongo()
                   .AddMetrics()
                   .AddJaeger()
                   .AddHandlersLogging()
                   .AddMongoRepository <CustomerDocument, Guid>("Customers")
                   .AddMongoRepository <OrderDocument, Guid>("Orders"));
        }
Esempio n. 2
0
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddSingleton <IDateTimeProvider, DateTimeProvider>();
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddTransient <IUserRepository, UserMongoRepository>();
            builder.Services.AddTransient <IAppContextFactory, AppContextFactory>();
            builder.Services.AddTransient(ctx => ctx.GetRequiredService <IAppContextFactory>().Create());
            builder.Services.TryDecorate(typeof(ICommandHandler <>), typeof(OutboxCommandHandlerDecorator <>));
            builder.Services.TryDecorate(typeof(IEventHandler <>), typeof(OutboxEventHandlerDecorator <>));

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddRabbitMq(plugins: p => p.AddJaegerRabbitMqPlugin())
                   .AddMessageOutbox(o => o.AddMongo())
                   .AddMongo()
                   .AddRedis()
                   .AddMetrics()
                   .AddJaeger()
                   .AddJaegerDecorators()
                   .AddHandlersLogging()
                   .AddMongoRepository <UserDocument, Guid>("identity"));
        }
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddSingleton <IEventMapper, EventMapper>();
            builder.Services.AddTransient <ITripRepository, TripsMongoRepository>();
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddTransient <IEventProcessor, EventProcessor>();


            builder.Services.Scan(s => s.FromAssemblies(AppDomain.CurrentDomain.GetAssemblies())
                                  .AddClasses(c => c.AssignableTo(typeof(IDomainEventHandler <>)))
                                  .AsImplementedInterfaces()
                                  .WithTransientLifetime());

            builder
            .AddQueryHandlers()
            .AddInMemoryQueryDispatcher()
            .AddErrorHandler <ExceptionToResponseMapper>()
            .AddExceptionToMessageMapper <ExceptionToMessageMapper>()
            .AddMongo()
            .AddMongoRepository <TripDocument, Guid>("trips")
            .AddRabbitMq()
            .AddSwaggerDocs()
            .AddWebApiSwaggerDocs();


            return(builder);
        }
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            var requestsOptions = builder.GetOptions <GumtreeOption>("gumtreeOptions");

            builder.Services.AddSingleton(requestsOptions);
            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddCommandHandlers()
                   .AddInMemoryCommandDispatcher());
        }
Esempio n. 5
0
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddTransient <IResourcesRepository, ResourceRepository>();

            builder
            .AddQueryHandlers()
            .AddInMemoryQueryDispatcher()
            .AddEfCore <EfCoreContext>()
            .AddEfCoreRepository <ResourceEntity, Guid>();

            return(builder);
        }
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddSingleton <IRoutingService, RoutingService>();

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddSwaggerDocs()
                   .AddWebApiSwaggerDocs());
        }
Esempio n. 7
0
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddTransient <ICustomersServiceClient, CustomersServiceClient>();
            builder.Services.AddTransient <ICustomerDiscountsService, CustomerDiscountsService>();

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddMetrics()
                   .AddJaeger());
        }
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddSingleton <IDateTimeProvider, DateTimeProvider>();
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddTransient <IParcelRepository, ParcelMongoRepository>();

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddRabbitMq()
                   .AddExceptionToMessageMapper <ExceptionToMessageMapper>()
                   .AddMongo()
                   .AddMongoRepository <ParcelDocument, Guid>("Parcels"));
        }
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddSingleton <IEventMapper, EventMapper>();
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddTransient <IDeliveriesRepository, DeliveriesMongoRepository>();
            builder.Services.AddSingleton <IDateTimeProvider, DateTimeProvider>();

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddRabbitMq()
                   .AddMongo()
                   .AddMongoRepository <DeliveryDocument, Guid>("Deliveries"));
        }
Esempio n. 10
0
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddSingleton <IDateTimeProvider, DateTimeProvider>();
            builder.Services.AddTransient <IParcelsRepository, ParcelsMongoRepository>();
            builder.Services.AddTransient <IAppContextFactory, AppContextFactory>();
            builder.Services.AddTransient(ctx => ctx.GetRequiredService <IAppContextFactory>().Create());

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddRabbitMq <CorrelationContext>()
                   .AddMongo()
                   .AddSwaggerDocs()
                   .AddWebApiSwaggerDocs());
        }
Esempio n. 11
0
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddTransient <IVehiclesRepository, VehiclesMongoRepository>();
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddTransient <IAppContextFactory, AppContextFactory>();
            builder.Services.AddTransient(ctx => ctx.GetRequiredService <IAppContextFactory>().Create());

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddRabbitMq <CorrelationContext>(plugins: p => p.RegisterJaeger())
                   .AddExceptionToMessageMapper <ExceptionToMessageMapper>()
                   .AddMongo()
                   .AddMetrics()
                   .AddJaeger()
                   .AddMongo()
                   .AddHandlersLogging()
                   .AddMongoRepository <VehicleDocument, Guid>("Vehicles"));
        }
Esempio n. 12
0
        public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
        {
            builder.Services.AddSingleton <IJwtProvider, JwtProvider>();
            builder.Services.AddSingleton <IPasswordService, PasswordService>();
            builder.Services.AddSingleton <IPasswordHasher <IPasswordService>, PasswordHasher <IPasswordService> >();
            builder.Services.AddTransient <IIdentityService, IdentityService>();
            builder.Services.AddTransient <IMessageBroker, MessageBroker>();
            builder.Services.AddTransient <IUserRepository, UserRepository>();
            builder.Services.AddTransient <IAppContextFactory, AppContextFactory>();
            builder.Services.AddTransient(ctx => ctx.GetRequiredService <IAppContextFactory>().Create());

            return(builder
                   .AddQueryHandlers()
                   .AddInMemoryQueryDispatcher()
                   .AddJwt()
                   .AddHttpClient()
                   .AddConsul()
                   .AddFabio()
                   .AddRabbitMq <CorrelationContext>(plugins: p => p.RegisterJaeger())
                   .AddMongo()
                   .AddMetrics()
                   .AddJaeger()
                   .AddMongoRepository <UserDocument, Guid>("Users"));
        }