Skip to content

Instantly share code, notes, and snippets.

@fasetto
Created October 16, 2017 14:04
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/eaf9cc8de9ccd7da4418ded4e339707c to your computer and use it in GitHub Desktop.
Save fasetto/eaf9cc8de9ccd7da4418ded4e339707c to your computer and use it in GitHub Desktop.
public class UnitOfWork
{
private readonly MongoDataContext _dataContext;
public UserRepository Users { get; private set; }
public UnitOfWork(MongoDataContext dataContext)
{
_dataContext = dataContext;
Users = new UserRepository(dataContext);
}
public bool CheckConnection()
{
try
{
_dataContext.Database.ListCollections();
}
catch (System.Exception)
{
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment