Ejemplo n.º 1
0
        public static IServiceCollection LoadApplicationConfiguration(this IServiceCollection services,
                                                                      IConfiguration configuration, string configurationSectionName)
        {
            var dataSourceSettings = new DataSourceSettings();

            configuration.GetSection(configurationSectionName).Bind(dataSourceSettings);

            switch (dataSourceSettings.DatabaseType)
            {
            //Mapping the Config data to fit Mongodb
            case SourceType.Mongodb:
                ConfigMongodbClassMapping.Mapping();
                break;

            case SourceType.MsSql:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            services.AddSingleton(sp =>
                                  new AppLoadConfig(dataSourceSettings).AppConfigInstance);

            services.AddSingleton <IDataSourceSettings>(dataSourceSettings);

            return(services);
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Seeding configuration data!");

            //mapping mongodb
            ConfigMongodbClassMapping.Mapping();

            Seeds.BuildConfiguration();
        }