private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { // this ensures the database is created with initial data CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); CloudscribeIdentityServerIntegrationEFCoreStorage.InitializeDatabaseAsync(scopedServices).Wait(); LoggingEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); }
private static void EnsureDataStorageIsReady(IServiceProvider services) { // this ensures the database is created with initial data CoreEFStartup.InitializeDatabaseAsync(services).Wait(); // this one is only needed if using cloudscribe Logging with EF as the logging storage LoggingEFStartup.InitializeDatabaseAsync(services).Wait(); }
private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { var deleteLogsOlderThanDays = 90; LoggingEFStartup.InitializeDatabaseAsync(scopedServices, deleteLogsOlderThanDays).Wait(); CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); }
private static async Task EnsureDataStorageIsReady(IServiceProvider services) { await CoreEFStartup.InitializeDatabaseAsync(services); await SimpleContentEFStartup.InitializeDatabaseAsync(services); await LoggingEFStartup.InitializeDatabaseAsync(services); }
private static void EnsureDataStorageIsReady(IServiceProvider services) { CoreEFStartup.InitializeDatabaseAsync(services).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(services).Wait(); LoggingEFStartup.InitializeDatabaseAsync(services).Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <cloudscribe.Core.Models.MultiTenantOptions> multiTenantOptionsAccessor, IServiceProvider serviceProvider, IOptions <RequestLocalizationOptions> localizationOptionsAccessor, cloudscribe.Logging.Web.ILogRepository logRepo ) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); ConfigureLogging(loggerFactory, serviceProvider, logRepo); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseForwardedHeaders(); app.UseStaticFiles(); // custom 404 and error page - this preserves the status code (ie 404) app.UseStatusCodePagesWithReExecute("/Home/Error/{0}"); app.UseSession(); app.UseRequestLocalization(localizationOptionsAccessor.Value); app.UseMultitenancy <cloudscribe.Core.Models.SiteContext>(); var multiTenantOptions = multiTenantOptionsAccessor.Value; app.UsePerTenant <cloudscribe.Core.Models.SiteContext>((ctx, builder) => { builder.UseCloudscribeCoreDefaultAuthentication( loggerFactory, multiTenantOptions, ctx.Tenant); }); UseMvc(app, multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName); // this creates ensures the database is created and initial data CoreEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); // this one is only needed if using cloudscribe Logging with EF as the logging storage LoggingEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); }
private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { var deleteLogsOlderThanDays = 90; LoggingEFStartup.InitializeDatabaseAsync(scopedServices, deleteLogsOlderThanDays).Wait(); CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); KvpEFCoreStartup.InitializeDatabaseAsync(scopedServices).Wait(); CloudscribeIdentityServerIntegrationEFCoreStorage.InitializeDatabaseAsync(scopedServices).Wait(); DynamicPolicyEFCore.InitializeDatabaseAsync(scopedServices).Wait(); }
private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { LoggingEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); KvpEFCoreStartup.InitializeDatabaseAsync(scopedServices).Wait(); EmailQueueDatabase.InitializeDatabaseAsync(scopedServices).Wait(); EmailListDatabase.InitializeDatabaseAsync(scopedServices).Wait(); EmailTemplateDatabase.InitializeDatabaseAsync(scopedServices).Wait(); }
private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { LoggingEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); EmailQueueDatabase.InitializeDatabaseAsync(scopedServices).Wait(); EmailTemplateDatabase.InitializeDatabaseAsync(scopedServices).Wait(); MembershipDatabase.InitializeDatabaseAsync(scopedServices).Wait(); DynamicPolicyEFCore.InitializeDatabaseAsync(scopedServices).Wait(); StripeDatabase.InitializeDatabaseAsync(scopedServices).Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <cloudscribe.Core.Models.MultiTenantOptions> multiTenantOptionsAccessor, IServiceProvider serviceProvider, IOptions <RequestLocalizationOptions> localizationOptionsAccessor, cloudscribe.Logging.Web.ILogRepository logRepo ) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); ConfigureLogging(loggerFactory, serviceProvider, logRepo); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/oops/error"); } app.UseForwardedHeaders(); app.UseStaticFiles(); //app.UseSession(); app.UseRequestLocalization(localizationOptionsAccessor.Value); var multiTenantOptions = multiTenantOptionsAccessor.Value; app.UseCloudscribeCore( loggerFactory, multiTenantOptions, SslIsAvailable); UseMvc(app, multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName); // this creates ensures the database is created and initial data CoreEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); // this one is only needed if using cloudscribe Logging with EF as the logging storage LoggingEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); }
private static void EnsureDataStorageIsReady(IConfiguration config, IServiceProvider scopedServices) { var storage = config["DevOptions:DbPlatform"]; switch (storage) { case "NoDb": CoreNoDbStartup.InitializeDataAsync(scopedServices).Wait(); break; case "ef": default: LoggingEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); KvpEFCoreStartup.InitializeDatabaseAsync(scopedServices).Wait(); break; } }
private static void EnsureDataStorageIsReady(IConfiguration config, IServiceProvider services) { var storage = config["DevOptions:DbPlatform"]; switch (storage) { case "NoDb": CoreNoDbStartup.InitializeDataAsync(services).Wait(); break; case "ef": default: // this creates ensures the database is created and initial data CoreEFStartup.InitializeDatabaseAsync(services).Wait(); LoggingEFStartup.InitializeDatabaseAsync(services).Wait(); KvpEFCoreStartup.InitializeDatabaseAsync(services).Wait(); break; } }
private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { #if (Logging) #if (!NoDb) var deleteLogsOlderThanDays = 90; LoggingEFStartup.InitializeDatabaseAsync(scopedServices, deleteLogsOlderThanDays).Wait(); #endif #endif #if (NoDb) CoreNoDbStartup.InitializeDataAsync(scopedServices).Wait(); #else CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); #endif #if (SimpleContentConfig != "z") #if (!NoDb) SimpleContentEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (KvpCustomRegistration || Newsletter) #if (!NoDb) KvpEFCoreStartup.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (IdentityServer) #if (NoDb) CloudscribeIdentityServerIntegrationNoDbStorage.InitializeDatabaseAsync(scopedServices).Wait(); #else CloudscribeIdentityServerIntegrationEFCoreStorage.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (FormBuilder) #if (!NoDb) FormsDatabase.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (Paywall) #if (!NoDb) MembershipDatabase.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (IncludeEmailQueue) #if (!NoDb) EmailQueueDatabase.InitializeDatabaseAsync(scopedServices).Wait(); EmailTemplateDatabase.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (Newsletter) #if (!NoDb) EmailListDatabase.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (IncludeStripeIntegration) #if (!NoDb) StripeDatabase.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (DynamicPolicy) #if (!NoDb) DynamicPolicyEFCore.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (CommentSystem) #if (!NoDb) CommentsDatabase.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif #if (Forum) #if (!NoDb) ForumDatabase.InitializeDatabaseAsync(scopedServices).Wait(); #endif #endif }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <cloudscribe.Core.Models.MultiTenantOptions> multiTenantOptionsAccessor, IServiceProvider serviceProvider ) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseSession(); app.UseMultitenancy <cloudscribe.Core.Models.SiteSettings>(); //app.UseTenantContainers<SiteSettings>(); var multiTenantOptions = multiTenantOptionsAccessor.Value; app.UsePerTenant <cloudscribe.Core.Models.SiteSettings>((ctx, builder) => { var tenant = ctx.Tenant; var shouldUseFolder = !multiTenantOptions.UseRelatedSitesMode && multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName && tenant.SiteFolderName.Length > 0; var externalCookieOptions = SetupOtherCookies(cloudscribe.Core.Identity.AuthenticationScheme.External, tenant); builder.UseCookieAuthentication(externalCookieOptions); var twoFactorRememberMeCookieOptions = SetupOtherCookies(cloudscribe.Core.Identity.AuthenticationScheme.TwoFactorRememberMe, tenant); builder.UseCookieAuthentication(twoFactorRememberMeCookieOptions); var twoFactorUserIdCookie = SetupOtherCookies(cloudscribe.Core.Identity.AuthenticationScheme.TwoFactorUserId, tenant); builder.UseCookieAuthentication(twoFactorUserIdCookie); var cookieEvents = new CookieAuthenticationEvents(); var logger = loggerFactory.CreateLogger <cloudscribe.Core.Identity.SiteAuthCookieValidator>(); var cookieValidator = new cloudscribe.Core.Identity.SiteAuthCookieValidator(logger); var appCookieOptions = SetupAppCookie( cookieEvents, cookieValidator, cloudscribe.Core.Identity.AuthenticationScheme.Application, tenant ); builder.UseCookieAuthentication(appCookieOptions); // known issue here is if a site is updated to populate the // social auth keys, it currently requires a restart so that the middleware gets registered // in order for it to work or for the social auth buttons to appear builder.UseSocialAuth(ctx.Tenant, externalCookieOptions, shouldUseFolder); }); UseMvc(app, multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName); var storage = Configuration["DevOptions:DbPlatform"]; switch (storage) { case "NoDb": CoreNoDbStartup.InitializeDataAsync(app.ApplicationServices).Wait(); break; case "ef": default: // this creates ensures the database is created and initial data CoreEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); // this one is only needed if using cloudscribe Logging with EF as the logging storage //cloudscribe.Logging.EF.LoggingDbInitializer.InitializeDatabaseAsync(app.ApplicationServices).Wait(); break; } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // you can add things to this method signature and they will be injected as long as they were registered during // ConfigureServices public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <cloudscribe.Core.Models.MultiTenantOptions> multiTenantOptionsAccessor, IServiceProvider serviceProvider, IOptions <RequestLocalizationOptions> localizationOptionsAccessor, cloudscribe.Logging.Web.ILogRepository logRepo ) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); ConfigureLogging(loggerFactory, serviceProvider, logRepo); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseForwardedHeaders(); app.UseStaticFiles(); app.UseSession(); app.UseRequestLocalization(localizationOptionsAccessor.Value); app.UseMultitenancy <cloudscribe.Core.Models.SiteContext>(); var multiTenantOptions = multiTenantOptionsAccessor.Value; app.UsePerTenant <cloudscribe.Core.Models.SiteContext>((ctx, builder) => { // custom 404 and error page - this preserves the status code (ie 404) if (string.IsNullOrEmpty(ctx.Tenant.SiteFolderName)) { builder.UseStatusCodePagesWithReExecute("/Home/Error/{0}"); } else { builder.UseStatusCodePagesWithReExecute("/" + ctx.Tenant.SiteFolderName + "/Home/Error/{0}"); } builder.UseCloudscribeCoreDefaultAuthentication( loggerFactory, multiTenantOptions, ctx.Tenant); // to make this multi tenant for folders // using a fork of IdentityServer4 and hoping to get changes so we don't need a fork // https://github.com/IdentityServer/IdentityServer4/issues/19 builder.UseIdentityServer(); // this sets up the authentication for apis within this application endpoint // ie apis that are hosted in the same web app endpoint with the authority server // this is not needed here if you are only using separate api endpoints // it is needed in the startup of those separate endpoints builder.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions { Authority = "https://localhost:51408", // using the site aliasid as the scope so each tenant has a different scope // you can view the aliasid from site settings // clients must be configured with the scope to have access to the apis for the tenant ApiName = ctx.Tenant.AliasId, RequireHttpsMetadata = false }); }); UseMvc(app, multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName); CoreEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); LoggingEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); CloudscribeIdentityServerIntegrationEFCoreStorage.InitializeDatabaseAsync(app.ApplicationServices).Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // you can add things to this method signature and they will be injected as long as they were registered during // ConfigureServices public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <cloudscribe.Core.Models.MultiTenantOptions> multiTenantOptionsAccessor, IServiceProvider serviceProvider, IOptions <RequestLocalizationOptions> localizationOptionsAccessor , cloudscribe.Logging.Web.ILogRepository logRepo ) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); ConfigureLogging(loggerFactory, serviceProvider, logRepo); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } var storage = Configuration["DevOptions:DbPlatform"]; switch (storage) { case "NoDb": CoreNoDbStartup.InitializeDataAsync(app.ApplicationServices).Wait(); // you can use this hack to add clients and scopes into the db since // there is currently no ui to do it // you should not use this on the first run that actually creates the initial cloudscribe data // you must wait until after that and then you can get the needed siteid from the database // this will only run at startup time and only add data if no data exists for the given site. // if you pass in an invalid siteid it will not fail, you will get data with a bad siteid // make note of your siteid, don't use these, these are from my NoDb storage // site1 05301194-da1d-43a8-9aa4-6c5f8959f37b // site2 a9e2c249-90b4-4770-9e99-9702d89f73b6 // replace null with your siteid and run the app, then change it back to null since it can only be a one time task string sId = null; CloudscribeIdentityServerIntegrationNoDbStorage.InitializeDatabaseAsync( app.ApplicationServices, sId, GetClients(), GetScopes() ).Wait(); break; case "ef": default: // this creates ensures the database is created and initial data CoreEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); // this one is only needed if using cloudscribe Logging with EF as the logging storage LoggingEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); // you can use this hack to add clients and scopes into the db since // there is currently no ui to do it // you should not use this on the first run that actually creates the initial cloudscribe data // you must wait until after that and then you can get the needed siteid from the database // this will only run at startup time and only add data if no data exists for the given site. // if you pass in an invalid siteid it will not fail, you will get data with a bad siteid // make note of your siteid, don't use these, these are from my db // site1 8f54733c-3f3a-4971-bb1f-8950cea42f1a // site2 7c111db3-e270-497a-9a12-aed436c764c6 // replace null with your siteid and run the app, then change it back to null since it can only be a one time task string siteId = null; CloudscribeIdentityServerIntegrationEFCoreStorage.InitializeDatabaseAsync( app.ApplicationServices, siteId, GetClients(), GetScopes() ).Wait(); break; } app.UseForwardedHeaders(); app.UseStaticFiles(); app.UseSession(); app.UseRequestLocalization(localizationOptionsAccessor.Value); app.UseMultitenancy <cloudscribe.Core.Models.SiteContext>(); var multiTenantOptions = multiTenantOptionsAccessor.Value; app.UsePerTenant <cloudscribe.Core.Models.SiteContext>((ctx, builder) => { // custom 404 and error page - this preserves the status code (ie 404) if (string.IsNullOrEmpty(ctx.Tenant.SiteFolderName)) { builder.UseStatusCodePagesWithReExecute("/Home/Error/{0}"); } else { builder.UseStatusCodePagesWithReExecute("/" + ctx.Tenant.SiteFolderName + "/Home/Error/{0}"); } builder.UseCloudscribeCoreDefaultAuthentication( loggerFactory, multiTenantOptions, ctx.Tenant); // to make this multi tenant for folders // using a fork of IdentityServer4 and hoping to get changes so we don't need a fork // https://github.com/IdentityServer/IdentityServer4/issues/19 builder.UseIdentityServer(); // this sets up the authentication for apis within this application endpoint // ie apis that are hosted in the same web app endpoint with the authority server // this is not needed here if you are only using separate api endpoints // it is needed in the startup of those separate endpoints builder.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions { Authority = "https://localhost:44399", // using the site aliasid as the scope so each tenant has a different scope // you can view the aliasid from site settings // clients must be configured with the scope to have access to the apis for the tenant ScopeName = ctx.Tenant.AliasId, RequireHttpsMetadata = true }); }); UseMvc(app, multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName); }
private static void EnsureDataStorageIsReady(IConfiguration config, IServiceProvider services) { var storage = config["DevOptions:DbPlatform"]; switch (storage) { case "NoDb": CoreNoDbStartup.InitializeDataAsync(services).Wait(); // you can use this hack to add clients and scopes into the db during startup if needed // I used this before we implemented the UI for adding them // you should not use this on the first run that actually creates the initial cloudscribe data // you must wait until after that and then you can get the needed siteid from the database // this will only run at startup time and only add data if no data exists for the given site. // if you pass in an invalid siteid it will not fail, you will get data with a bad siteid // make note of your siteid, don't use these, these are from my NoDb storage // site1 05301194-da1d-43a8-9aa4-6c5f8959f37b // site2 a9e2c249-90b4-4770-9e99-9702d89f73b6 // replace null with your siteid and run the app, then change it back to null since it can only be a one time task string sId = null; CloudscribeIdentityServerIntegrationNoDbStorage.InitializeDatabaseAsync( services, sId, IdServerClients.Get(), IdServerResources.GetApiResources(), IdServerResources.GetIdentityResources() ).Wait(); break; case "ef": default: // this creates ensures the database is created and initial data CoreEFStartup.InitializeDatabaseAsync(services).Wait(); // this one is only needed if using cloudscribe Logging with EF as the logging storage LoggingEFStartup.InitializeDatabaseAsync(services).Wait(); KvpEFCoreStartup.InitializeDatabaseAsync(services).Wait(); // you can use this hack to add clients and scopes into the db during startup if needed // I used this before we implemented the UI for adding them // you should not use this on the first run that actually creates the initial cloudscribe data // you must wait until after that and then you can get the needed siteid from the database // this will only run at startup time and only add data if no data exists for the given site. // if you pass in an invalid siteid it will not fail, you will get data with a bad siteid // make note of your siteid, don't use these, these are from my db // site1 8f54733c-3f3a-4971-bb1f-8950cea42f1a // site2 7c111db3-e270-497a-9a12-aed436c764c6 // replace null with your siteid and run the app, then change it back to null since it can only be a one time task string siteId = null; CloudscribeIdentityServerIntegrationEFCoreStorage.InitializeDatabaseAsync( services, siteId, IdServerClients.Get(), IdServerResources.GetApiResources(), IdServerResources.GetIdentityResources() ).Wait(); break; } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <cloudscribe.Core.Models.MultiTenantOptions> multiTenantOptionsAccessor, IServiceProvider serviceProvider, IOptions <RequestLocalizationOptions> localizationOptionsAccessor, cloudscribe.Logging.Web.ILogRepository logRepo ) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); ConfigureLogging(loggerFactory, serviceProvider, logRepo); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/oops/error"); } app.UseForwardedHeaders(); app.UseStaticFiles(); // custom 404 and error page - this preserves the status code (ie 404) //app.UseStatusCodePagesWithReExecute("/Home/Error/{0}"); //app.UseSession(); app.UseRequestLocalization(localizationOptionsAccessor.Value); var multiTenantOptions = multiTenantOptionsAccessor.Value; app.UseCloudscribeCore( loggerFactory, multiTenantOptions, SslIsAvailable); UseMvc(app, multiTenantOptions.Mode == cloudscribe.Core.Models.MultiTenantMode.FolderName); var storage = Configuration["DevOptions:DbPlatform"]; switch (storage) { case "NoDb": CoreNoDbStartup.InitializeDataAsync(app.ApplicationServices).Wait(); break; case "ef": default: // this creates ensures the database is created and initial data CoreEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); // this one is only needed if using cloudscribe Logging with EF as the logging storage LoggingEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); SimpleContentEFStartup.InitializeDatabaseAsync(app.ApplicationServices).Wait(); break; } }
/// <summary> /// this invokes methods to run migrations and seeds initial data if applicable /// </summary> /// <param name="scopedServices"></param> private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { LoggingEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); ToDoDatabase.InitializeDatabaseAsync(scopedServices).Wait(); }