private IntegratedPipelineBlueprint InitializeBlueprint() { IntegratedPipelineBlueprintStage firstStage = null; string appStartup = ConfigurationManager.AppSettings[Constants.OwinAppStartup]; var loader = new DefaultLoader(); Action <IAppBuilder> startup = loader.Load(appStartup ?? string.Empty); if (startup == null) { return(null); } var appContext = OwinBuilder.Build(builder => { EnableIntegratedPipeline(builder, stage => firstStage = stage); startup.Invoke(builder); }); if (appContext == null) { return(null); } string basePath = Utils.NormalizePath(HttpRuntime.AppDomainAppVirtualPath); return(new IntegratedPipelineBlueprint(appContext, firstStage, basePath)); }
public IntegratedPipelineBlueprint( OwinAppContext appContext, IntegratedPipelineBlueprintStage firstStage, string pathBase) { _appContext = appContext; _firstStage = firstStage; _pathBase = pathBase; }
public IntegratedPipelineBlueprint( OwinAppContext appContext, IntegratedPipelineBlueprintStage firstStage, string pathBase) { _appContext = appContext; _firstStage = firstStage; _pathBase = pathBase; }
private IntegratedPipelineBlueprint InitializeBlueprint() { IntegratedPipelineBlueprintStage firstStage = null; Action <IAppBuilder> startup = OwinBuilder.GetAppStartup(); OwinAppContext appContext = OwinBuilder.Build(builder => { EnableIntegratedPipeline(builder, stage => firstStage = stage); startup.Invoke(builder); }); string basePath = Utils.NormalizePath(HttpRuntime.AppDomainAppVirtualPath); return(new IntegratedPipelineBlueprint(appContext, firstStage, basePath)); }
private static void EnableIntegratedPipeline(IAppBuilder app, Action <IntegratedPipelineBlueprintStage> onStageCreated) { var stage = new IntegratedPipelineBlueprintStage { Name = "PreHandlerExecute" }; onStageCreated(stage); Action <IAppBuilder, string> stageMarker = (builder, name) => { Func <AppFunc, AppFunc> decoupler = next => { if (string.Equals(name, stage.Name, StringComparison.OrdinalIgnoreCase)) { // no decoupling needed when pipeline is already split at this name return(next); } if (!IntegratedPipelineContext.VerifyStageOrder(name, stage.Name)) { // Stage markers added out of order will be ignored. // Out of order stages/middleware may be run earlier than expected. // TODO: LOG return(next); } stage.EntryPoint = next; stage = new IntegratedPipelineBlueprintStage { Name = name, NextStage = stage, }; onStageCreated(stage); return((AppFunc)IntegratedPipelineContext.ExitPointInvoked); }; app.Use(decoupler); }; app.Properties[Constants.IntegratedPipelineStageMarker] = stageMarker; app.Properties[Constants.BuilderDefaultApp] = (Func <IDictionary <string, object>, Task>)IntegratedPipelineContext.DefaultAppInvoked; }