/// <summary> /// Standard Startup file initialisation /// </summary> /// <param name="app">Application Builder</param> /// <param name="life">Application Lifetime</param> public void Initialise(IApplicationBuilder app, IApplicationLifetime life) { if (app != null) { RequestContextManager.Instance = new RequestContextManager(app.ApplicationServices); // Initialise user system this.SecurityManager = Membership.SecurityManager.Current = app.ApplicationServices.GetService <ISecurityManager>(); this.SecurityManager.InitialiseDataApi(); var partManager = app.ApplicationServices.GetService <ApplicationPartManager>(); var controllerFeature = new ControllerFeature(); partManager.PopulateFeature(controllerFeature); ContentTypeHierarchy.RegisterControllers(controllerFeature.Controllers); } Modules.ValidateModules(); Settings.RunTypeSetup?.Invoke(Collator); if (Settings.ApplyDbContext == null) // use SqlServer setup by default { Settings = Settings.UseDefaultDbContextBuilder((builder, conn) => builder.UseSqlServer(conn)); } Collator.BuildRepository(); Modules.Initialise(this); if (life != null) { life.ApplicationStopped.Register(Modules.Shutdown); } }