Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created September 29, 2017 16:17
Show Gist options
  • Save NMZivkovic/23b5c235534ef96f619461dfa4a96ed6 to your computer and use it in GitHub Desktop.
Save NMZivkovic/23b5c235534ef96f619461dfa4a96ed6 to your computer and use it in GitHub Desktop.
/// <summary>
/// Class used to access Mongo DB.
/// </summary>
public class UsersRepository
{
private IMongoClient _client;
private IMongoDatabase _database;
private IMongoCollection<User> _usersCollection;
public UsersRepository(string connectionString)
{
_client = new MongoClient(connectionString);
_database = _client.GetDatabase("blog");
_usersCollection = _database.GetCollection<User>("users");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment