Skip to content

Instantly share code, notes, and snippets.

@fasetto
Created October 16, 2017 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fasetto/939854e9a7c34d9cafd83f1b37ff15ff to your computer and use it in GitHub Desktop.
Save fasetto/939854e9a7c34d9cafd83f1b37ff15ff to your computer and use it in GitHub Desktop.
public class MongoDataContext
{
public IMongoDatabase Database { get; }
public MongoDataContext(string connectionString)
{
var mongoUrl = new MongoUrl(connectionString);
IMongoClient client = new MongoClient(mongoUrl);
Database = client.GetDatabase(mongoUrl.DatabaseName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment