You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
762 B
C#
32 lines
762 B
C#
|
|
using EntrustSettle.Common;
|
|
using MongoDB.Driver;
|
|
|
|
namespace EntrustSettle.Repository.MongoRepository
|
|
{
|
|
|
|
public class MongoDbContext
|
|
{
|
|
private readonly IMongoDatabase _database = null;
|
|
|
|
public MongoDbContext()
|
|
{
|
|
var client = new MongoClient(AppSettings.app(new string[] { "Mongo", "ConnectionString" }));
|
|
_database = client.GetDatabase(AppSettings.app(new string[] { "Mongo", "Database" }));
|
|
}
|
|
|
|
public IMongoDatabase Db
|
|
{
|
|
get { return _database; }
|
|
}
|
|
|
|
//public IMongoCollection<TEntity> Query
|
|
//{
|
|
// get
|
|
// {
|
|
// return _database.GetCollection<TEntity>(nameof(TEntity));
|
|
// }
|
|
//}
|
|
}
|
|
}
|