コード例 #1
0
        private static void EnsureDataStorageIsReady(IServiceProvider services)
        {
            CoreEFStartup.InitializeDatabaseAsync(services).Wait();

            SimpleContentEFStartup.InitializeDatabaseAsync(services).Wait();

            LoggingEFStartup.InitializeDatabaseAsync(services).Wait();
        }
コード例 #2
0
        private static void EnsureDataStorageIsReady(IServiceProvider scopedServices)
        {
            var deleteLogsOlderThanDays = 90;

            LoggingEFStartup.InitializeDatabaseAsync(scopedServices, deleteLogsOlderThanDays).Wait();
            CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait();
            SimpleContentEFStartup.InitializeDatabaseAsync(scopedServices).Wait();
        }
コード例 #3
0
    private static async Task EnsureDataStorageIsReady(IServiceProvider services)
    {
        await CoreEFStartup.InitializeDatabaseAsync(services);

        await SimpleContentEFStartup.InitializeDatabaseAsync(services);

        await LoggingEFStartup.InitializeDatabaseAsync(services);
    }
コード例 #4
0
        // 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();
        }
コード例 #5
0
 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();
 }
コード例 #6
0
        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();
        }
コード例 #7
0
        // 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();
        }
コード例 #8
0
        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;
            }
        }
コード例 #9
0
 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
 }
コード例 #10
0
        // 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;
            }
        }