Created
December 29, 2015 10:49
-
-
Save mizrael/d9c9f061b3934a037b21 to your computer and use it in GitHub Desktop.
simple Mongodb database factory implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MongoDatabaseFactory : IMongoDatabaseFactory | |
{ | |
public IMongoDatabase Connect(string connectionString, string dbName) | |
{ | |
if(string.IsNullOrWhiteSpace(connectionString)) | |
throw new ArgumentNullException("connectionString"); | |
if (string.IsNullOrWhiteSpace(dbName)) | |
throw new ArgumentNullException("dbName"); | |
var dbClient = new MongoClient(connectionString); | |
return dbClient.GetDatabase(dbName); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment