Created
October 16, 2017 14:04
-
-
Save fasetto/eaf9cc8de9ccd7da4418ded4e339707c to your computer and use it in GitHub Desktop.
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 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