public static List <QueryConfig> BuildConfigApp(IDataSourceSettings dbSettings) { IMongodbContext context = new MongodbContext(dbSettings); var listOfQueryConfigs = context.GetCollection <QueryConfig>(dbSettings.Entity).AsQueryable().ToList(); return(listOfQueryConfigs); }
public static void BuildConfiguration() { var collectionOfConnectStrings = ConfigurationHelper.LoadConfiguration(); IDataSourceSettings settings = new DataSourceSettings { ConnectionString = collectionOfConnectStrings.ReadWriteConnectionString, Database = collectionOfConnectStrings.Database, Entity = collectionOfConnectStrings.Entity }; var collectionName = collectionOfConnectStrings.Entity; IMongodbContext context = new MongodbContext(settings); var collection = context.GetCollection <QueryConfig>(collectionName); collection.DeleteMany(new BsonDocument()); //delete all collection.InsertMany(SeedData.GetConfigurationData(collectionOfConnectStrings)); }