示例#1
0
        public static ApplicationSettings CreateInMemoryApplicationSettingsStandard(string name)
        {
            //if (configurationRoot == null)
            //{
            var configurationBuilder = new Microsoft.Extensions.Configuration.ConfigurationBuilder();

            Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(configurationBuilder, "appsettings.json", optional: false, reloadOnChange: true);
            Microsoft.Extensions.Configuration.IConfiguration configurationRoot = configurationBuilder.Build();
            //}
            var appSettings = new Routines.Configuration.Standard.AppSettings(configurationRoot);

            var configurationManagerLoader    = new Routines.Configuration.Standard.ConfigurationManagerLoader(configurationRoot);
            var configurationContainerFactory = ResetConfigurationContainerFactoryStandard(configurationManagerLoader);
            var unhandledExceptionLogging     = new NUnhandledExceptionLogging();

            return(new ApplicationSettings(appSettings, configurationContainerFactory, unhandledExceptionLogging, new AdminkaStorageConfiguration(name, null, StorageType.INMEMORY, null)));
        }
示例#2
0
        public static ApplicationSettings CreateApplicationSettingsStandard(Microsoft.Extensions.Configuration.IConfiguration configurationRoot = null, string migrationAssembly = null)
        {
            if (configurationRoot == null)
            {
                var configurationBuilder = new Microsoft.Extensions.Configuration.ConfigurationBuilder();
                Microsoft.Extensions.Configuration.JsonConfigurationExtensions.AddJsonFile(configurationBuilder, "appsettings.json", optional: false, reloadOnChange: true);
                configurationRoot = configurationBuilder.Build();
            }
            var connectionStringMap         = new Routines.Configuration.Standard.ConnectionStringMap(configurationRoot);
            var connectionString            = connectionStringMap.GetConnectionString("AdminkaConnectionString");
            var adminkaStorageConfiguration = new AdminkaStorageConfiguration(connectionString, migrationAssembly, StorageType.SQLSERVER, migrationAssembly == null?default(int?):5 * 60);

            var appSettings = new Routines.Configuration.Standard.AppSettings(configurationRoot);

            var configurationManagerLoader    = new Routines.Configuration.Standard.ConfigurationManagerLoader(configurationRoot);
            var configurationContainerFactory = ResetConfigurationContainerFactoryStandard(configurationManagerLoader);
            var unhandledExceptionLogging     = new NUnhandledExceptionLogging();

            return(new ApplicationSettings(appSettings, configurationContainerFactory, unhandledExceptionLogging, adminkaStorageConfiguration));
        }