// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(c => { c.Filters.Add <AssignAuthenticatedUserIdActionFilter>(); c.AddAuthenticatedUserIdAwareBodyModelBinderProvider(); }).AddFluentValidation(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Online Store API", Version = "v1" }); c.SchemaFilter <SwaggerAuthenticatedUserIdFilter>(); c.OperationFilter <SwaggerAuthenticatedUserIdOperationFilter>(); }); CommandingDependencyResolver = new MicrosoftDependencyInjectionCommandingResolver(services); ICommandRegistry registry = CommandingDependencyResolver.UseCommanding(); services .UseShoppingCart(registry) .UseStore(registry) .UseCheckout(registry); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(c => { c.Filters.Add <AssignAuthenticatedUserIdActionFilter>(); c.AddAuthenticatedUserIdAwareBodyModelBinderProvider(); }).AddFluentValidation(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Online Store API", Version = "v1" }); c.SchemaFilter <SwaggerAuthenticatedUserIdFilter>(); c.OperationFilter <SwaggerAuthenticatedUserIdOperationFilter>(); }); TelemetryClient client = new TelemetryClient(); services.AddSingleton <IMetricCollectorFactory>(s => new MetricCollectorFactory(client)); CommandingDependencyResolver = new MicrosoftDependencyInjectionCommandingResolver(services); ICommandRegistry registry = CommandingDependencyResolver.UseCommanding(); services .UseShoppingCart(registry) .UseStore(registry) .UseCheckout(registry); services.Replace(new ServiceDescriptor(typeof(ICommandDispatcher), typeof(LoggingCommandDispatcher), ServiceLifetime.Transient)); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); _commandingDependencyResolver = new MicrosoftDependencyInjectionCommandingResolver(services); _commandingDependencyResolver.UseCommanding() .Register <UpdatePersonalDetailsCommandHandler>(); _commandingDependencyResolver.UseExecutionCommandingAuditor <ExecutionAuditor>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Online Store API", Version = "v1" }); }); CommandingDependencyResolver = new MicrosoftDependencyInjectionCommandingResolver(services); ICommandRegistry registry = CommandingDependencyResolver.UseCommanding(); services .UseShoppingCart(registry) .UseStore(registry) .UseCheckout(registry); }
private static ICommandDispatcher Configure() { ServiceCollection serviceCollection = new ServiceCollection(); Options options = new Options { Reset = true // we reset the registry because we allow repeat runs, in a normal app this isn't required }; IMicrosoftDependencyInjectionCommandingResolver dependencyResolver = serviceCollection.UseCommanding(options); dependencyResolver.Registry .Register <CancellablePipelineAwarePipelineCommandActor>(1) .Register <PipelineCommandActor>(2); dependencyResolver.ServiceProvider = serviceCollection.BuildServiceProvider(); return(dependencyResolver.ServiceProvider.GetService <ICommandDispatcher>()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(c => { c.Filters.Add <AssignAuthenticatedUserIdActionFilter>(); c.AddAuthenticatedUserIdAwareBodyModelBinderProvider(); }).AddFluentValidation(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "Online Store API", Version = "v1" }); c.SchemaFilter <SwaggerAuthenticatedUserIdFilter>(); c.OperationFilter <SwaggerAuthenticatedUserIdOperationFilter>(); }); TelemetryClient client = new TelemetryClient(); services.AddSingleton <IMetricCollector>(s => new MetricCollector(client)); CommandingDependencyResolver = new MicrosoftDependencyInjectionCommandingResolver(services); ICommandRegistry registry = CommandingDependencyResolver.UseCommanding(new Options { CommandExecutionExceptionHandler = typeof(CommandExecutionExceptionHandler) }); CommandingDependencyResolver .UsePreDispatchCommandingAuditor <LoggingCommandPreDispatchAuditor>() .UseExecutionCommandingAuditor <LoggingCommandExecutionAuditor>() .UseAuditItemEnricher <AuditItemUserIdEnricher>(); services .UseShoppingCart(registry) .UseStore(registry) .UseCheckout(registry); }