Example #1
0
        private static void EnsureDataStorageIsReady(IServiceProvider scopedServices)
        {
            var deleteLogsOlderThanDays = 90;

            LoggingEFStartup.InitializeDatabaseAsync(scopedServices, deleteLogsOlderThanDays).Wait();
            CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait();
            SimpleContentEFStartup.InitializeDatabaseAsync(scopedServices).Wait();
            KvpEFCoreStartup.InitializeDatabaseAsync(scopedServices).Wait();
            DynamicPolicyEFCore.InitializeDatabaseAsync(scopedServices).Wait();
        }
Example #2
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();
 }
Example #3
0
        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(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;
            }
        }
Example #5
0
        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
 }
Example #7
0
        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;
            }
        }