The MongoDbRepository now has a constructor that takes an IMongoDatabase.

This commit is contained in:
alexandre-spieser
2017-11-01 08:18:29 +00:00
parent fbb07475a1
commit 657beeac99
18 changed files with 52 additions and 29 deletions
@@ -900,6 +900,15 @@ namespace MongoDbGenericRepository
MongoDbContext = mongoDbContext;
}
/// <summary>
/// The contructor taking a <see cref="IMongoDatabase"/>.
/// </summary>
/// <param name="mongoDatabase">A mongodb context implementing <see cref="IMongoDatabase"/></param>
protected BaseMongoRepository(IMongoDatabase mongoDatabase)
{
MongoDbContext = new MongoDbContext(mongoDatabase);
}
/// <summary>
/// The MongoDbContext
/// </summary>
@@ -2009,6 +2018,7 @@ namespace MongoDbGenericRepository
}
/// <summary>
/// Groups filtered a collection of documents given a grouping criteria,
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
/// </summary>
@@ -53,5 +53,11 @@ namespace MongoDbGenericRepository
/// </summary>
/// <typeparam name="TDocument"></typeparam>
void DropCollection<TDocument>(string partitionKey);
/// <summary>
/// Sets the Guid representation of the MongoDb Driver.
/// </summary>
/// <param name="guidRepresentation">The new value of the GuidRepresentation</param>
void SetGuidRepresentation(MongoDB.Bson.GuidRepresentation guidRepresentation);
}
}
@@ -25,6 +25,15 @@ namespace MongoDbGenericRepository
MongoDefaults.GuidRepresentation = MongoDB.Bson.GuidRepresentation.Standard;
}
/// <summary>
/// Sets the Guid representation of the MongoDb Driver.
/// </summary>
/// <param name="guidRepresentation">The new value of the GuidRepresentation</param>
public void SetGuidRepresentation(MongoDB.Bson.GuidRepresentation guidRepresentation)
{
MongoDefaults.GuidRepresentation = guidRepresentation;
}
/// <summary>
/// The constructor of the MongoDbContext, it needs a an object implementing <see cref="IMongoDatabase"/>.
/// </summary>