adding Key typed base repo functionality

This commit is contained in:
Alexandre SPIESER
2019-04-04 23:45:07 +01:00
parent f773e599d0
commit ba723be738
5 changed files with 165 additions and 22 deletions
@@ -13,7 +13,7 @@ namespace MongoDbGenericRepository
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
/// Its constructor must be given a connection string and a database name.
/// </summary>
public abstract partial class ReadOnlyMongoRepository
public abstract partial class ReadOnlyMongoRepository : KeyTypedReadOnlyMongoRepository<Guid>, IReadOnlyMongoRepository
{
/// <summary>
/// The constructor taking a connection string and a database name.
@@ -249,9 +249,9 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))
.SortBy(minValueSelector)
.Limit(1)
.FirstOrDefaultAsync();
.SortBy(minValueSelector)
.Limit(1)
.FirstOrDefaultAsync();
}
/// <summary>
@@ -321,8 +321,8 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>
{
return await GetMaxMongoQuery<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey)
.Project(maxValueSelector)
.FirstOrDefaultAsync();
.Project(maxValueSelector)
.FirstOrDefaultAsync();
}
/// <summary>