示例#1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider services,
                              OperationPipeline pipelineBuilder, IContractRegistry contracts)
        {
            app.UseStaticFiles();

            app.ConfigureExceptionHandler();

            app.UseRouting();

            app.UseMiddleware <CookieIdentificationMiddleware>();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapPost("/api/operations/{title}",
                                  services.GetService <OperationRequestHandler>().InvokeAsync);
                endpoints.MapControllerRoute("Default", "/api/{controller}/{action=Index}");
            });

            foreach (var startup in _startups)
            {
                startup.Configure(pipelineBuilder, contracts, services);
            }
            pipelineBuilder.Build();

            if (Log.IsEnabled(Serilog.Events.LogEventLevel.Information))
            {
                Log.Information("Registered operations: {0}", string.Join(", ", contracts.OperationContracts.Keys));
                Log.Information("Registered events: {0}", string.Join(", ", contracts.EventContracts.Keys));
                Log.Information("Registered data types: {0}", string.Join(", ", contracts.DataContracts.Keys));
            }
        }
示例#2
0
文件: Startup.cs 项目: Hazuwall/Mark2
 public void Configure(IOperationPipelineBuilder pipeline, IContractRegistry contracts, IServiceProvider services)
 {
     // Контракты операций, событий и данных автоматически регистрируются из контракта сервиса
     contracts.RegisterServiceContract <ISubDemoPlugin>();
     // Дополняется конвейер обработки операций
     pipeline
     .AddPipe <HrPipe>()
     .AddPipe <SubOfTheDayPipe>()
     .AddPipe <OrderCounterPipe>()
     .AddPipe <KitchenPipe>();
 }
示例#3
0
 public ContractsController(IContractRegistry contracts)
 {
     _contracts = contracts;
 }
示例#4
0
文件: Startup.cs 项目: Hazuwall/Mark2
 public void Configure(IOperationPipelineBuilder pipeline, IContractRegistry contracts, IServiceProvider services)
 {
     contracts.RegisterServiceContract <IMotionPlugin>();
     pipeline.AddPipe <OdometryPipe>();
 }
示例#5
0
 public OperationRequestHandler(IContractRegistry contracts, OperationPipeline pipeline)
 {
     _contracts = contracts;
     _pipeline  = pipeline;
 }