private MongoDatabase GetMongoDBFor(ConfigurationSettings.ConfigurationEntryElement config) { var connectionString = "mongodb://localhost/?safe=true"; var client = new MongoClient(connectionString); var server = client.GetServer(); var database = server.GetDatabase(config.Database); return(database); //new Mongo(config.Database, config.Server, config.Port, ""); }
public MongoDatabase GetMongoDBFor(string configEntry) { ConfigurationSettings.ConfigurationEntryElement config = GetMongoDBConfig(configEntry); MongoDatabase mdb = ContextDatabases.ContainsKey(configEntry) ? ContextDatabases[configEntry] : null; if (mdb == null) { mdb = GetMongoDBFor(config); ContextDatabases[configEntry] = mdb; } if (mdb == null) { throw new ApplicationException("Unable to create Mongo database"); } return(mdb); }