reformatting

This commit is contained in:
Sean Garrett
2023-07-06 13:00:55 +01:00
parent c70727212e
commit 26b71ff76e
24 changed files with 3041 additions and 980 deletions
@@ -25,7 +25,11 @@ namespace MongoDbGenericRepository
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<List<TDocument>> GetPaginatedAsync<TDocument>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50, string partitionKey = null)
Task<List<TDocument>> GetPaginatedAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
int skipNumber = 0,
int takeNumber = 50,
string partitionKey = null)
where TDocument : IDocument;
/// <summary>
@@ -37,7 +41,11 @@ namespace MongoDbGenericRepository
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50, string partitionKey = null)
Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
int skipNumber = 0,
int takeNumber = 50,
string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -49,7 +57,10 @@ namespace MongoDbGenericRepository
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
Task<TDocument> GetAndUpdateOne<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options)
Task<TDocument> GetAndUpdateOne<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument;
/// <summary>
@@ -61,7 +72,10 @@ namespace MongoDbGenericRepository
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
Task<TDocument> GetAndUpdateOne<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options)
Task<TDocument> GetAndUpdateOne<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
}
@@ -2,6 +2,7 @@
using MongoDbGenericRepository.Models;
using System;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
namespace MongoDbGenericRepository
@@ -21,6 +22,17 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Asynchronously Updates a document.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates a document.
/// </summary>
@@ -31,6 +43,17 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates a document.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary>
@@ -42,6 +65,18 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="update">The update definition for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary>
@@ -53,6 +88,45 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="update">The update definition for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value..
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value..
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value..
/// </summary>
@@ -63,7 +137,22 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value..
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -80,6 +169,47 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value.
/// </summary>
@@ -90,7 +220,22 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entity selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -107,6 +252,20 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
@@ -116,8 +275,21 @@ namespace MongoDbGenericRepository
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -131,7 +303,105 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Updates the property field with the given value update a property field in entities.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -145,45 +415,7 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null)
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -197,7 +429,35 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -211,7 +471,45 @@ namespace MongoDbGenericRepository
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -223,7 +521,7 @@ namespace MongoDbGenericRepository
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null)
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -235,7 +533,264 @@ namespace MongoDbGenericRepository
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null)
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, updates the property field with the given value.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <typeparam name="TField">The type of the field.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// For the entities selected by the filter, applies the update you have defined in MongoDb.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">The document filter.</param>
/// <param name="updateDefinition">The update definition to apply.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
}
@@ -12,7 +12,6 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// </summary>
public interface IBaseMongoRepository_Update_ClientSession
{
/// <summary>
/// Updates a document.
/// </summary>
@@ -24,7 +23,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -40,7 +43,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -56,7 +64,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -73,7 +86,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -88,7 +107,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -104,7 +127,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -120,7 +148,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -137,7 +170,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -152,7 +191,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -168,7 +211,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -220,7 +268,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)
bool UpdateOne<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -235,7 +287,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -251,7 +307,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -267,7 +328,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param>
/// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -284,7 +350,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -299,7 +371,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -315,7 +391,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -331,7 +412,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="partitionKey">The optional partition key.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -348,7 +434,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -363,7 +455,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field to update.</param>
/// <param name="value">The value of the field.</param>
/// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -379,7 +475,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -431,7 +532,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns>A boolean value indicating success.</returns>
Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)
Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
}
@@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
using CancellationToken = System.Threading.CancellationToken;
namespace MongoDbGenericRepository
{
@@ -488,7 +488,11 @@ namespace MongoDbGenericRepository
/// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken)
Task<bool> AnyAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -760,7 +764,11 @@ namespace MongoDbGenericRepository
/// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken)
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -852,7 +860,11 @@ namespace MongoDbGenericRepository
/// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption, string partitionKey, CancellationToken cancellationToken)
List<TDocument> GetAll<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1032,7 +1044,11 @@ namespace MongoDbGenericRepository
/// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption, string partitionKey, CancellationToken cancellationToken)
Task<long> CountAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1241,7 +1257,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, CancellationToken cancellationToken)
Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1255,7 +1274,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey)
Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1269,7 +1291,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey, CancellationToken cancellationToken)
Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1294,7 +1320,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, CancellationToken cancellationToken)
TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1307,7 +1336,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey)
TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1321,7 +1353,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey, CancellationToken cancellationToken)
TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1346,7 +1382,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, CancellationToken cancellationToken)
Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1359,7 +1398,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey)
Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1373,7 +1415,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey, CancellationToken cancellationToken)
Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1398,7 +1444,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, CancellationToken cancellationToken)
TDocument GetByMin<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1425,7 +1474,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector for the minimum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey, CancellationToken cancellationToken)
TDocument GetByMin<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1450,7 +1503,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken)
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1463,7 +1519,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey)
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1477,7 +1536,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector for the maximum value you are looking for.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken)
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1502,7 +1565,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken)
TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1515,7 +1581,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey)
TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1529,7 +1598,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken)
TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1554,7 +1627,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken)
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1567,7 +1643,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey)
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1581,7 +1660,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken)
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1606,7 +1689,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken)
TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1619,7 +1705,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey)
TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1633,7 +1722,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken)
TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1660,7 +1753,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, CancellationToken cancellationToken)
Task<int> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1685,7 +1781,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey, CancellationToken cancellationToken)
Task<int> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1720,7 +1820,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, CancellationToken cancellationToken)
Task<decimal> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1745,7 +1848,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, string partitionKey, CancellationToken cancellationToken)
Task<decimal> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1776,7 +1883,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1790,7 +1899,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1804,7 +1916,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1819,7 +1934,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
Task<TProjection> ProjectOneAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1846,7 +1965,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1860,7 +1982,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1875,7 +2000,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1888,7 +2017,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1902,7 +2033,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1916,7 +2050,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1931,7 +2068,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1944,7 +2085,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter"></param>
/// <param name="projection">The projection expression.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1958,7 +2101,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1972,7 +2118,10 @@ namespace MongoDbGenericRepository
/// <param name="filter"></param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -1987,7 +2136,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -2006,7 +2159,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -2022,7 +2177,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -2038,7 +2196,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -2055,7 +2216,11 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -2071,7 +2236,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -2088,7 +2256,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -2105,7 +2277,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -2123,7 +2299,12 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -410,7 +410,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, CancellationToken cancellationToken)
Task<TDocument> GetByMaxAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -421,7 +424,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey)
Task<TDocument> GetByMaxAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -433,7 +439,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey, CancellationToken cancellationToken)
Task<TDocument> GetByMaxAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -456,7 +466,10 @@ namespace MongoDbGenericRepository
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, CancellationToken cancellationToken)
TDocument GetByMax<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -481,7 +494,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey, CancellationToken cancellationToken)
TDocument GetByMax<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByDescending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -502,7 +519,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, CancellationToken cancellationToken)
Task<TDocument> GetByMinAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -513,7 +533,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey)
Task<TDocument> GetByMinAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -525,7 +548,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey, CancellationToken cancellationToken)
Task<TDocument> GetByMinAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -546,7 +573,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, CancellationToken cancellationToken)
TDocument GetByMin<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -569,7 +599,11 @@ namespace MongoDbGenericRepository
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey, CancellationToken cancellationToken)
TDocument GetByMin<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> orderByAscending,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -590,7 +624,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken)
Task<TValue> GetMaxValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -601,7 +638,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey)
Task<TValue> GetMaxValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -613,7 +653,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken)
Task<TValue> GetMaxValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -634,7 +678,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, CancellationToken cancellationToken)
TValue GetMaxValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
@@ -646,7 +693,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey)
TValue GetMaxValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -658,7 +708,11 @@ namespace MongoDbGenericRepository
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey, CancellationToken cancellationToken)
TValue GetMaxValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -680,7 +734,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken)
Task<TValue> GetMinValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
@@ -692,7 +749,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey)
Task<TValue> GetMinValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -704,7 +764,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken)
Task<TValue> GetMinValueAsync<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -725,7 +789,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, CancellationToken cancellationToken)
TValue GetMinValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
@@ -737,7 +804,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey)
TValue GetMinValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -749,7 +819,11 @@ namespace MongoDbGenericRepository
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey, CancellationToken cancellationToken)
TValue GetMinValue<TDocument, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
#endregion
@@ -772,7 +846,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<int> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, CancellationToken cancellationToken)
Task<int> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -793,7 +870,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<int> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, int>> selector, string partitionKey, CancellationToken cancellationToken)
Task<int> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -812,7 +893,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<decimal> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, CancellationToken cancellationToken)
Task<decimal> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -833,7 +917,11 @@ namespace MongoDbGenericRepository
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<decimal> SumByAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, decimal>> selector, string partitionKey, CancellationToken cancellationToken)
Task<decimal> SumByAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -885,7 +973,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -897,7 +988,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -910,9 +1004,14 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token</param>
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
Task<TProjection> ProjectOneAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
/// <summary>
/// Returns a projected document matching the filter condition.
/// </summary>
@@ -932,7 +1031,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
TProjection ProjectOne<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -944,7 +1046,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
TProjection ProjectOne<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
TProjection ProjectOne<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -957,7 +1062,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
TProjection ProjectOne<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -968,7 +1077,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type representing the model you want to project to.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -980,7 +1091,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -992,7 +1106,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -1005,7 +1122,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
Task<List<TProjection>> ProjectManyAsync<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -1028,7 +1149,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="cancellationToken">The cancellation token</param>
List<TProjection> ProjectMany<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, CancellationToken cancellationToken)
List<TProjection> ProjectMany<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -1040,7 +1164,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
List<TProjection> ProjectMany<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey)
List<TProjection> ProjectMany<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -1053,7 +1180,11 @@ namespace MongoDbGenericRepository
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token</param>
List<TProjection> ProjectMany<TDocument, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey, CancellationToken cancellationToken)
List<TProjection> ProjectMany<TDocument, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class;
@@ -1070,7 +1201,9 @@ namespace MongoDbGenericRepository
/// <typeparam name="TProjection">The type of the projected group.</typeparam>
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -1084,7 +1217,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -1098,7 +1234,10 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -1113,7 +1252,11 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -1127,7 +1270,10 @@ namespace MongoDbGenericRepository
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -1142,7 +1288,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -1157,7 +1307,11 @@ namespace MongoDbGenericRepository
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -1173,7 +1327,12 @@ namespace MongoDbGenericRepository
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TGroupKey>> groupingCriteria, Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection, string partitionKey, CancellationToken cancellationToken)
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TProjection : class, new();
@@ -7,6 +7,5 @@ namespace MongoDbGenericRepository
/// </summary>
public interface IReadOnlyMongoRepository : IBaseReadOnlyRepository, IReadOnlyMongoRepository<Guid>
{
}
}
@@ -422,7 +422,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);
@@ -436,21 +439,31 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);
}
/// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<Guid>
{
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public async Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);
@@ -465,7 +478,9 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -473,7 +488,9 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -482,7 +499,10 @@ namespace MongoDbGenericRepository
/// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -498,7 +518,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -506,7 +529,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -514,7 +540,11 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -543,7 +573,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);
@@ -557,21 +590,31 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateHashedIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);
}
/// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<Guid>
{
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);
@@ -586,7 +629,9 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -594,7 +639,9 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -602,7 +649,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -618,7 +668,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -626,7 +679,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -634,7 +690,11 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -649,21 +709,28 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken)
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, null, cancellationToken);
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions)
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<Guid>
{
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, CancellationToken.None);
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, null, cancellationToken);
@@ -677,21 +744,31 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken)
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, null, partitionKey, cancellationToken);
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey)
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<Guid>
{
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<Guid>
{
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey, cancellationToken);
@@ -706,7 +783,9 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -714,7 +793,9 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -722,7 +803,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -730,7 +814,9 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -738,7 +824,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -746,7 +835,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -754,7 +846,11 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -1,10 +1,10 @@
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
using MongoDbGenericRepository.Utils;
using System;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
using MongoDbGenericRepository.Utils;
namespace MongoDbGenericRepository
{
@@ -66,46 +66,17 @@ namespace MongoDbGenericRepository
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
/// <param name="partitionKey">An optional partition key.</param>
public virtual async Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, int skipNumber = 0, int takeNumber = 50, string partitionKey = null)
public virtual async Task<List<TDocument>> GetPaginatedAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
int skipNumber = 0,
int takeNumber = 50,
string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).Skip(skipNumber).Limit(takeNumber).ToListAsync();
}
#region Find And Update
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options) where TDocument : IDocument
{
return await GetCollection<TDocument>().FindOneAndUpdateAsync(filter, update, options);
}
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>().FindOneAndUpdateAsync(filter, update, options);
}
#endregion Find And Update
/// <summary>
/// Sets the value of the document Id if it is not set already.
/// </summary>
@@ -120,6 +91,7 @@ namespace MongoDbGenericRepository
{
throw new ArgumentNullException(nameof(document));
}
var defaultTKey = default(TKey);
if (document.Id == null
|| (defaultTKey != null
@@ -134,13 +106,15 @@ namespace MongoDbGenericRepository
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="document">The document.</param>
protected void FormatDocument<TDocument>(TDocument document) where TDocument : IDocument
protected void FormatDocument<TDocument>(TDocument document)
where TDocument : IDocument
{
if (document == null)
{
throw new ArgumentNullException(nameof(document));
}
if (document.Id == default(Guid))
if (document.Id == default)
{
document.Id = Guid.NewGuid();
}
@@ -159,6 +133,7 @@ namespace MongoDbGenericRepository
{
return GetCollection<TDocument>(partitionKey);
}
return GetCollection<TDocument>();
}
@@ -173,5 +148,45 @@ namespace MongoDbGenericRepository
{
return MongoDbContext.GetCollection<TDocument>(partitionKey);
}
#region Find And Update
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument
{
return await GetCollection<TDocument>().FindOneAndUpdateAsync(filter, update, options);
}
/// <summary>
/// GetAndUpdateOne with filter
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="update"></param>
/// <param name="options"></param>
/// <returns></returns>
public virtual async Task<TDocument> GetAndUpdateOne<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> update,
FindOneAndUpdateOptions<TDocument, TDocument> options)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>().FindOneAndUpdateAsync(filter, update, options);
}
#endregion Find And Update
}
}
File diff suppressed because it is too large Load Diff
@@ -43,7 +43,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
TProjection ProjectOne<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -76,7 +81,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">The document filter.</param>
/// <param name="projection">The projection expression.</param>
/// <param name="partitionKey">An optional partition key.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TProjection>> projection, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> ProjectMany<TDocument, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TProjection>> projection,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class;
@@ -92,10 +102,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="groupingCriteria">The grouping criteria.</param>
/// <param name="groupProjection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey = null, CancellationToken cancellationToken = default)
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -112,11 +124,13 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="selector">The grouping criteria.</param>
/// <param name="projection">The projected group result.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">The cancellation token.</param>
List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TGroupKey>> selector,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> projection,
string partitionKey = null, CancellationToken cancellationToken = default)
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new();
@@ -207,6 +221,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="id">The Id of the document you want to get.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetById<TDocument, TKey>(TKey id, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -220,7 +235,9 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetOneAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption = null,
Task<TDocument> GetOneAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
@@ -234,7 +251,10 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
Task<TDocument> GetOneAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -246,7 +266,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="condition">A mongodb filter definition.</param>
/// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param>
TDocument GetOne<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption = null, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetOne<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -257,6 +282,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -281,7 +307,10 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<bool> AnyAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null, string partitionKey = null,
Task<bool> AnyAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -294,7 +323,10 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<bool> AnyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
Task<bool> AnyAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -306,8 +338,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="condition">A mongodb filter definition.</param>
/// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partition key.</param>
bool Any<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null,
string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
bool Any<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -318,6 +354,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
bool Any<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -331,8 +368,11 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(FilterDefinition<TDocument> condition,
FindOptions findOption = null, string partitionKey = null, CancellationToken cancellationToken = default)
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -344,7 +384,10 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
Task<List<TDocument>> GetAllAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -356,8 +399,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="condition">A mongodb filter definition.</param>
/// <param name="findOption">A mongodb filter option.</param>
/// <param name="partitionKey">An optional partition key.</param>
List<TDocument> GetAll<TDocument, TKey>(FilterDefinition<TDocument> condition, FindOptions findOption = null,
string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
List<TDocument> GetAll<TDocument, TKey>(
FilterDefinition<TDocument> condition,
FindOptions findOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -368,7 +415,11 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param>
List<TDocument> GetAll<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
List<TDocument> GetAll<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -381,8 +432,11 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<long> CountAsync<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null,
string partitionKey = null, CancellationToken cancellationToken = default)
Task<long> CountAsync<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -394,7 +448,10 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<long> CountAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
Task<long> CountAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -406,8 +463,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="condition">A mongodb filter definition.</param>
/// <param name="countOption">A mongodb counting option.</param>
/// <param name="partitionKey">An optional partitionKey</param>
long Count<TDocument, TKey>(FilterDefinition<TDocument> condition, CountOptions countOption = null,
string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
long Count<TDocument, TKey>(
FilterDefinition<TDocument> condition,
CountOptions countOption = null,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -418,12 +479,14 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partitionKey</param>
/// <param name="cancellationToken">The cancellation token.</param>
long Count<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -431,24 +494,35 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
Task<TDocument> GetByMaxAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMax<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
@@ -456,19 +530,29 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
Task<TDocument> GetByMinAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the
/// filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
TDocument GetByMin<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, object>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -482,7 +566,11 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -495,7 +583,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> maxValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -509,7 +602,11 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -522,7 +619,12 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null, CancellationToken cancellationToken = default)
/// <param name="cancellationToken">The cancellation token.</param>
TValue GetMinValue<TDocument, TKey, TValue>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TValue>> minValueSelector,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -535,7 +637,8 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<int> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter,
Task<int> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
string partitionKey = null,
CancellationToken cancellationToken = default)
@@ -551,9 +654,11 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
/// <param name="cancellationToken">An optional cancellation Token.</param>
Task<decimal> SumByAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter,
Task<decimal> SumByAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
string partitionKey = null, CancellationToken cancellationToken = default)
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -565,7 +670,8 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
int SumBy<TDocument, TKey>(Expression<Func<TDocument, bool>> filter,
int SumBy<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, int>> selector,
string partitionKey = null)
where TDocument : IDocument<TKey>
@@ -579,7 +685,8 @@ namespace MongoDbGenericRepository.DataAccess.Read
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="selector">The field you want to sum.</param>
/// <param name="partitionKey">The partition key of your document, if any.</param>
decimal SumBy<TDocument, TKey>(Expression<Func<TDocument, bool>> filter,
decimal SumBy<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, decimal>> selector,
string partitionKey = null)
where TDocument : IDocument<TKey>
@@ -15,7 +15,8 @@ namespace MongoDbGenericRepository.DataAccess.Read
public virtual List<TProjection> GroupBy<TDocument, TGroupKey, TProjection, TKey>(
Expression<Func<TDocument, TGroupKey>> groupingCriteria,
Expression<Func<IGrouping<TGroupKey, TDocument>, TProjection>> groupProjection,
string partitionKey = null, CancellationToken cancellationToken = default)
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
where TProjection : class, new()
@@ -23,7 +24,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
return HandlePartitioned<TDocument, TKey>(partitionKey)
.Aggregate()
.Group(groupingCriteria, groupProjection)
.ToList(cancellationToken:cancellationToken);
.ToList(cancellationToken);
}
/// <inheritdoc />
@@ -32,7 +32,10 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="documentToModify">The document you want to modify.</param>
/// <param name="update">The update definition for the document.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey>(
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -46,7 +49,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -61,7 +68,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -76,7 +88,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">An optional cancellation token.</param>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -103,7 +120,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -119,7 +140,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -136,7 +162,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -153,7 +185,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -190,7 +228,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="field">The field selector.</param>
/// <param name="value">The new value of the property field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default)
bool UpdateOne<TDocument, TKey, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -205,7 +247,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
bool UpdateOne<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -220,7 +267,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
bool UpdateOne<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -247,7 +299,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">The update definition.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default)
bool UpdateOne<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -263,7 +319,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The value of the field.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -280,7 +341,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -297,7 +364,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="partitionKey">The optional partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
/// <returns></returns>
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -312,7 +385,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
Task<long> UpdateManyAsync<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -327,7 +405,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
Task<long> UpdateManyAsync<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -340,7 +423,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="update">the update definition</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> update, string partitionKey = null, CancellationToken cancellationToken = default)
Task<long> UpdateManyAsync<TDocument, TKey>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> update,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -353,7 +440,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="updateDefinition">The update definition.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
Task<long> UpdateManyAsync<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null, CancellationToken cancellationToken = default)
Task<long> UpdateManyAsync<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -368,7 +459,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The partition key for the document.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
long UpdateMany<TDocument, TKey, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -383,7 +479,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="value">The new value of the property field.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
long UpdateMany<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
long UpdateMany<TDocument, TKey, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -396,7 +497,11 @@ namespace MongoDbGenericRepository.DataAccess.Update
/// <param name="updateDefinition">The update definition.</param>
/// <param name="partitionKey">The value of the partition key.</param>
/// <param name="cancellationToken">The optional cancellation token.</param>
long UpdateMany<TDocument, TKey>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey = null, CancellationToken cancellationToken = default)
long UpdateMany<TDocument, TKey>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
}
@@ -1,16 +1,19 @@
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
using System;
using System;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository.DataAccess.Update
{
public partial class MongoDbUpdater
{
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default)
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument modifiedDocument,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -27,22 +30,32 @@ namespace MongoDbGenericRepository.DataAccess.Update
where TKey : IEquatable<TKey>
{
var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id);
var updateRes = HandlePartitioned<TDocument, TKey>(modifiedDocument).ReplaceOne(session, filter, modifiedDocument, cancellationToken: cancellationToken);
var updateRes = HandlePartitioned<TDocument, TKey>(modifiedDocument)
.ReplaceOne(session, filter, modifiedDocument, cancellationToken: cancellationToken);
return updateRes.ModifiedCount == 1;
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default)
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(session, filter, update, null, cancellationToken).ConfigureAwait(false);
var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(session, filter, update, null, cancellationToken)
.ConfigureAwait(false);
return updateRes.ModifiedCount == 1;
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default)
public virtual bool UpdateOne<TDocument, TKey>(
IClientSessionHandle session,
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -52,7 +65,12 @@ namespace MongoDbGenericRepository.DataAccess.Update
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default)
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -65,27 +83,49 @@ namespace MongoDbGenericRepository.DataAccess.Update
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default)
public virtual bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(
session,
filter,
Builders<TDocument>.Update.Set(field, value),
cancellationToken: cancellationToken);
return updateRes.ModifiedCount == 1;
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);
var updateRes = await collection.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken).ConfigureAwait(false);
var updateRes = await collection.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)
.ConfigureAwait(false);
return updateRes.ModifiedCount == 1;
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
public virtual Task<bool> UpdateOneAsync<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -93,7 +133,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
public virtual bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -103,7 +149,13 @@ namespace MongoDbGenericRepository.DataAccess.Update
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default)
public virtual bool UpdateOne<TDocument, TKey, TField>(
IClientSessionHandle session,
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey = null,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -56,7 +56,10 @@ namespace MongoDbGenericRepository.DataAccess.Update
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default)
public virtual bool UpdateOne<TDocument, TKey>(
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
@@ -83,12 +86,19 @@ namespace MongoDbGenericRepository.DataAccess.Update
}
/// <inheritdoc cref="IMongoDbUpdater" />
public virtual bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default)
public virtual bool UpdateOne<TDocument, TKey, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken = default)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(
filter,
Builders<TDocument>.Update.Set(field, value),
cancellationToken: cancellationToken);
return updateRes.ModifiedCount == 1;
}
@@ -296,6 +296,5 @@ namespace MongoDbGenericRepository
long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
}
}
@@ -137,7 +137,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateTextIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -152,7 +155,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateTextIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -168,7 +174,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateTextIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -224,7 +234,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -253,7 +266,10 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -268,7 +284,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -284,7 +303,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -340,7 +363,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -369,7 +395,10 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -384,7 +413,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -400,7 +432,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -456,7 +492,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -485,7 +524,10 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -500,7 +542,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -516,7 +561,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateHashedIndexAsync<TDocument, TKey>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -557,7 +606,9 @@ namespace MongoDbGenericRepository
/// <param name="fields">The fields we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions)
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -572,7 +623,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -601,7 +655,10 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -616,7 +673,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -632,7 +692,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
@@ -1,10 +1,10 @@
using MongoDbGenericRepository.DataAccess.Delete;
using MongoDbGenericRepository.Models;
using System;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using MongoDbGenericRepository.DataAccess.Delete;
using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository
{
@@ -20,7 +20,10 @@ namespace MongoDbGenericRepository
{
get
{
if (_mongoDbEraser != null) { return _mongoDbEraser; }
if (_mongoDbEraser != null)
{
return _mongoDbEraser;
}
lock (_initLock)
{
@@ -29,9 +32,10 @@ namespace MongoDbGenericRepository
_mongoDbEraser = new MongoDbEraser(MongoDbContext);
}
}
return _mongoDbEraser;
}
set { _mongoDbEraser = value; }
set => _mongoDbEraser = value;
}
/// <inheritdoc />
@@ -112,7 +116,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<long> DeleteOneAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);
@@ -154,7 +161,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<long> DeleteManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<long> DeleteManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbEraser.DeleteManyAsync<TDocument, TKey>(filter, partitionKey, cancellationToken);
@@ -178,21 +188,21 @@ namespace MongoDbGenericRepository
public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter)
where TDocument : IDocument<TKey>
{
return DeleteMany<TDocument>(filter, null, CancellationToken.None);
return DeleteMany(filter, null, CancellationToken.None);
}
/// <inheritdoc />
public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return DeleteMany<TDocument>(filter, null, cancellationToken);
return DeleteMany(filter, null, cancellationToken);
}
/// <inheritdoc />
public virtual long DeleteMany<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey)
where TDocument : IDocument<TKey>
{
return DeleteMany<TDocument>(filter, partitionKey, CancellationToken.None);
return DeleteMany(filter, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
@@ -298,14 +298,19 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey>
{
return await CreateHashedIndexAsync(field, indexCreationOptions, null, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await CreateHashedIndexAsync(field, indexCreationOptions, null, cancellationToken);
@@ -319,21 +324,31 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await CreateHashedIndexAsync(field, null, partitionKey, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await CreateHashedIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbIndexHandler.CreateHashedIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);
@@ -347,21 +362,28 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await CreateCombinedTextIndexAsync(fields, null, null, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions)
where TDocument : IDocument<TKey>
{
return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, null, cancellationToken);
@@ -375,21 +397,31 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await CreateCombinedTextIndexAsync(fields, null, partitionKey, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await CreateCombinedTextIndexAsync(fields, indexCreationOptions, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbIndexHandler.CreateCombinedTextIndexAsync<TDocument, TKey>(fields, indexCreationOptions, partitionKey, cancellationToken);
@@ -1,6 +1,6 @@
using MongoDB.Driver;
using System;
using MongoDB.Driver;
using MongoDbGenericRepository.Models;
using System;
namespace MongoDbGenericRepository
{
@@ -14,7 +14,6 @@ namespace MongoDbGenericRepository
IBaseMongoRepository<TKey>
where TKey : IEquatable<TKey>
{
private readonly object _initLock = new object();
/// <summary>
@@ -55,6 +54,7 @@ namespace MongoDbGenericRepository
{
return GetCollection<TDocument>(partitionKey);
}
return GetCollection<TDocument>();
}
@@ -17,16 +17,6 @@ namespace MongoDbGenericRepository
public abstract class ReadOnlyMongoRepository<TKey> : IReadOnlyMongoRepository<TKey>
where TKey : IEquatable<TKey>
{
/// <summary>
/// The MongoDbContext
/// </summary>
protected IMongoDbContext MongoDbContext { get; set; }
/// <summary>
/// A MongoDb Reader for read operations
/// </summary>
protected IMongoDbReader MongoDbReader { get; set; }
/// <summary>
/// The constructor taking a connection string and a database name.
/// </summary>
@@ -55,6 +45,16 @@ namespace MongoDbGenericRepository
SetupMongoDbContext(mongoDbContext);
}
/// <summary>
/// The MongoDbContext
/// </summary>
protected IMongoDbContext MongoDbContext { get; set; }
/// <summary>
/// A MongoDb Reader for read operations
/// </summary>
protected IMongoDbReader MongoDbReader { get; set; }
/// <summary>
/// The connection string.
/// </summary>
@@ -1,10 +1,10 @@
using MongoDB.Driver;
using MongoDbGenericRepository.DataAccess.Update;
using MongoDbGenericRepository.Models;
using System;
using System;
using System.Linq.Expressions;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDbGenericRepository.DataAccess.Update;
using MongoDbGenericRepository.Models;
namespace MongoDbGenericRepository
{
@@ -20,7 +20,10 @@ namespace MongoDbGenericRepository
{
get
{
if (_mongoDbUpdater != null) { return _mongoDbUpdater; }
if (_mongoDbUpdater != null)
{
return _mongoDbUpdater;
}
lock (_initLock)
{
@@ -32,7 +35,7 @@ namespace MongoDbGenericRepository
return _mongoDbUpdater;
}
set { _mongoDbUpdater = value; }
set => _mongoDbUpdater = value;
}
/// <inheritdoc />
@@ -71,7 +74,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument>(TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken)
public virtual async Task<bool> UpdateOneAsync<TDocument>(
TDocument documentToModify,
UpdateDefinition<TDocument> update,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(documentToModify, update, cancellationToken);
@@ -99,7 +105,11 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual bool UpdateOne<TDocument, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);
@@ -113,7 +123,11 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
TDocument documentToModify,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(documentToModify, field, value, cancellationToken);
@@ -127,21 +141,34 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual bool UpdateOne<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return UpdateOne(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual bool UpdateOne<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual bool UpdateOne<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -155,133 +182,210 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual bool UpdateOne<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return UpdateOne(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual bool UpdateOne<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return UpdateOne(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual bool UpdateOne<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
{
return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await UpdateOneAsync(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
{
return await UpdateOneAsync(filter, field, value, null, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await UpdateOneAsync(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await UpdateOneAsync(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, field, value, null, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -295,21 +399,31 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
public virtual async Task<long> UpdateManyAsync<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -323,21 +437,31 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, updateDefinition, null, cancellationToken);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey)
public virtual async Task<long> UpdateManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey)
where TDocument : IDocument<TKey>
{
return await UpdateManyAsync(filter, updateDefinition, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual async Task<long> UpdateManyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
public virtual async Task<long> UpdateManyAsync<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return await MongoDbUpdater.UpdateManyAsync<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -351,21 +475,34 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return UpdateMany(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual long UpdateMany<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return UpdateMany(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument, TField>(
Expression<Func<TDocument, bool>> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -379,21 +516,34 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, null, cancellationToken);
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey)
public virtual long UpdateMany<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, CancellationToken.None);
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument, TField>(
FilterDefinition<TDocument> filter,
Expression<Func<TDocument, TField>> field,
TField value,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateMany<TDocument, TKey, TField>(filter, field, value, partitionKey, cancellationToken);
@@ -407,7 +557,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return UpdateMany(filter, updateDefinition, null, cancellationToken);
@@ -421,7 +574,11 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument>(FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument>(
FilterDefinition<TDocument> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -435,7 +592,10 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return UpdateMany(filter, updateDefinition, null, cancellationToken);
@@ -449,7 +609,11 @@ namespace MongoDbGenericRepository
}
/// <inheritdoc />
public virtual long UpdateMany<TDocument>(Expression<Func<TDocument, bool>> filter, UpdateDefinition<TDocument> updateDefinition, string partitionKey, CancellationToken cancellationToken)
public virtual long UpdateMany<TDocument>(
Expression<Func<TDocument, bool>> filter,
UpdateDefinition<TDocument> updateDefinition,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>
{
return MongoDbUpdater.UpdateMany<TDocument, TKey>(filter, updateDefinition, partitionKey, cancellationToken);
@@ -11,7 +11,8 @@ namespace MongoDbGenericRepository
/// The interface exposing index management functionality for Key typed repositories.
/// </summary>
/// <typeparam name="TKey"></typeparam>
public interface IBaseMongoRepository_Index<TKey> where TKey : IEquatable<TKey>
public interface IBaseMongoRepository_Index<TKey>
where TKey : IEquatable<TKey>
{
/// <summary>
/// Returns the names of the indexes present on a collection.
@@ -94,7 +95,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateTextIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -146,7 +150,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateTextIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
@@ -195,7 +203,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateAscendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -233,7 +244,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateAscendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -247,7 +261,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateAscendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -295,7 +313,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -333,7 +354,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -347,7 +371,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateDescendingIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -395,7 +423,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -433,7 +464,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -447,7 +481,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateHashedIndexAsync<TDocument>(
Expression<Func<TDocument, object>> field,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -495,7 +533,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -520,7 +561,10 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -533,7 +577,10 @@ namespace MongoDbGenericRepository
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey)
Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey)
where TDocument : IDocument<TKey>;
/// <summary>
@@ -547,7 +594,11 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
Task<string> CreateCombinedTextIndexAsync<TDocument>(
IEnumerable<Expression<Func<TDocument, object>>> fields,
IndexCreationOptions indexCreationOptions,
string partitionKey,
CancellationToken cancellationToken)
where TDocument : IDocument<TKey>;
/// <summary>