Beispiel #1
0
 public static DonutDbConfig GetOrAdd(string role, DonutDbConfig toDonutDbConfig)
 {
     if (_databases.ContainsKey(role))
     {
         return(_databases[role]);
     }
     else
     {
         RegisterConfig(toDonutDbConfig);
         _databases[toDonutDbConfig.Role] = toDonutDbConfig;
         return(toDonutDbConfig);
     }
 }
Beispiel #2
0
 private static void RegisterConfig(DonutDbConfig cfg)
 {
     _databases[cfg.Role] = cfg;
 }
Beispiel #3
0
        public static IMongoDatabase GetDatabase()
        {
            var dbc = DonutDbConfig.GetConfig();

            return(GetDatabase(dbc));
        }
Beispiel #4
0
        public static IMongoCollection <BsonDocument> GetCollection(string collectionName)
        {
            var config = DonutDbConfig.GetConfig();

            return(GetCollection(config, collectionName));
        }
Beispiel #5
0
        public static IMongoCollection <T> GetCollection <T>(string collectionName)
        {
            var config = DonutDbConfig.GetConfig();

            return(GetCollection <T>(config, collectionName));
        }