Beispiel #1
0
        public static void ConfigureOData(this IApplicationBuilder app, IConfigureServiceApiPipeline contextPipeline, IConfigureOpsServiceApiPipeline contextOpsServiceApiPipeline, NodeContext node)
        {
            // Initialize plugins OData contexts
            app.InitializeODataBuilder();
            var modelBuilder = new ODataConventionModelBuilder();

            // Run the pipeline to configure the plugin's OData context
            var contextResult = contextPipeline.Run(modelBuilder, node.GetPipelineContextOptions()).Result;

            contextResult.Namespace = "Sitecore.Commerce.Engine";

            // Get the model and register the ODataRoute
            var model = contextResult.GetEdmModel();

            app.UseRouter(new ODataRoute("Api", model));

            // Register the bootstrap context for the engine
            modelBuilder = new ODataConventionModelBuilder();
            var contextOpsResult = contextOpsServiceApiPipeline.Run(modelBuilder, node.GetPipelineContextOptions()).Result;

            contextOpsResult.Namespace = "Sitecore.Commerce.Engine";

            // Get the model and register the ODataRoute
            model = contextOpsResult.GetEdmModel();
            app.UseRouter(new ODataRoute("CommerceOps", model));
        }
Beispiel #2
0
        /// <summary>
        /// Configures the specified application.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="contextPipeline">The context pipeline.</param>
        /// <param name="startNodePipeline">The start node pipeline.</param>
        /// <param name="contextOpsServiceApiPipeline">The API pipeline.</param>
        /// <param name="startEnvironmentPipeline">The start environment pipeline.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        public void Configure(
            IApplicationBuilder app,
            IConfigureServiceApiPipeline contextPipeline,
            IStartNodePipeline startNodePipeline,
            IConfigureOpsServiceApiPipeline contextOpsServiceApiPipeline,
            IStartEnvironmentPipeline startEnvironmentPipeline,
            ILoggerFactory loggerFactory)
        {
            // Add Application Insights monitoring to the request pipeline as a very first middleware.
            app.UseApplicationInsightsRequestTelemetry();

            // Add Application Insights exceptions handling to the request pipeline.
            app.UseApplicationInsightsExceptionTelemetry();

            app.UseDiagnostics();

            // Add static files to the request pipeline.
            app.UseStaticFiles();

            // Set the error page
            if (this._hostEnv.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseStatusCodePages();
            }

            startNodePipeline.Run(this.NodeContext, this.NodeContext.GetPipelineContextOptions()).Wait();

            // Starting the environment to register Minion policies and run Minions
            var environmentName = this._configuration.GetSection("AppSettings:EnvironmentName").Value;

            ////this.NodeContext.AddDataMessage("EnvironmentStartup", $"StartEnvironment={environmentName}");

            ////startEnvironmentPipeline.Run(environmentName, this.NodeContext.GetPipelineContextOptions()).Wait();

            // Initialize plugins OData contexts
            app.InitializeODataBuilder();
            var modelBuilder = new ODataConventionModelBuilder();

            // Run the pipeline to configure the plugin's OData context
            var contextResult = contextPipeline.Run(modelBuilder, this.NodeContext.GetPipelineContextOptions()).Result;

            contextResult.Namespace = "Sitecore.Commerce.Engine";

            // Get the model and register the ODataRoute
            var model = contextResult.GetEdmModel();

            app.UseRouter(new ODataRoute("Api", model));

            // Register the bootstrap context for the engine
            modelBuilder = new ODataConventionModelBuilder();
            var contextOpsResult = contextOpsServiceApiPipeline.Run(modelBuilder, this.NodeContext.GetPipelineContextOptions()).Result;

            contextOpsResult.Namespace = "Sitecore.Commerce.Engine";

            // Get the model and register the ODataRoute
            model = contextOpsResult.GetEdmModel();
            app.UseRouter(new ODataRoute("CommerceOps", model));
        }