reformatting
This commit is contained in:
@@ -11,12 +11,12 @@ using MongoDbGenericRepository.Models;
|
||||
namespace MongoDbGenericRepository.DataAccess.Read
|
||||
{
|
||||
/// <summary>
|
||||
/// A interface for accessing the Database and its Collections.
|
||||
/// A interface for accessing the Database and its Collections.
|
||||
/// </summary>
|
||||
public interface IMongoDbReader : IDataAccessBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously returns a projected document matching the filter condition.
|
||||
/// Asynchronously returns a projected document matching the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -35,7 +35,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TProjection : class;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a projected document matching the filter condition.
|
||||
/// Returns a projected document matching the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -43,13 +43,18 @@ 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;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns a list of projected documents matching the filter condition.
|
||||
/// Asynchronously returns a list of projected documents matching the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -68,7 +73,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TProjection : class;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns a list of projected documents matching the filter condition.
|
||||
/// Asynchronously returns a list of projected documents matching the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -76,14 +81,19 @@ 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;
|
||||
|
||||
/// <summary>
|
||||
/// Groups a collection of documents given a grouping criteria,
|
||||
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
|
||||
/// Groups a collection of documents given a grouping criteria,
|
||||
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -92,17 +102,19 @@ 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();
|
||||
|
||||
/// <summary>
|
||||
/// Groups filtered a collection of documents given a grouping criteria,
|
||||
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
|
||||
/// Groups filtered a collection of documents given a grouping criteria,
|
||||
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -112,18 +124,20 @@ 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();
|
||||
|
||||
/// <summary>
|
||||
/// Groups filtered a collection of documents given a grouping criteria,
|
||||
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
|
||||
/// Groups filtered a collection of documents given a grouping criteria,
|
||||
/// and returns a dictionary of listed document groups with keys having the different values of the grouping criteria.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -145,7 +159,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TProjection : class, new();
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns a paginated list of the documents matching the filter condition.
|
||||
/// Asynchronously returns a paginated list of the documents matching the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -168,7 +182,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns a paginated list of the documents matching the filter condition.
|
||||
/// Asynchronously returns a paginated list of the documents matching the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -189,7 +203,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns one document given its id.
|
||||
/// Asynchronously returns one document given its id.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -201,18 +215,19 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns one document given its id.
|
||||
/// Returns one document given its id.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns one document given filter definition.
|
||||
/// Asynchronously returns one document given filter definition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -220,49 +235,60 @@ 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>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns one document given an expression filter.
|
||||
/// Asynchronously returns one document given an expression 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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns one document given filter definition.
|
||||
/// Returns one document given filter definition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns one document given an expression filter.
|
||||
/// Returns one document given an expression 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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a collection cursor.
|
||||
/// Returns a collection cursor.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -273,7 +299,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -281,49 +307,60 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// Returns true if any of the document of the collection matches the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns a list of the documents matching the filter condition.
|
||||
/// Asynchronously returns a list of the documents matching the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -331,49 +368,63 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously returns a list of the documents matching the filter condition.
|
||||
/// Asynchronously returns a list of the documents matching the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of the documents matching the filter condition.
|
||||
/// Returns a list of the documents matching the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of the documents matching the filter condition.
|
||||
/// Returns a list of the documents matching the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously counts how many documents match the filter condition.
|
||||
/// Asynchronously counts how many documents match the filter condition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -381,49 +432,61 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously counts how many documents match the filter condition.
|
||||
/// Asynchronously counts how many documents match the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Counts how many documents match the filter condition.
|
||||
/// Counts how many documents match the filter condition.
|
||||
/// </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="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>;
|
||||
|
||||
/// <summary>
|
||||
/// Counts how many documents match the filter condition.
|
||||
/// Counts how many documents match the filter condition.
|
||||
/// </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="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,24 +530,34 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
|
||||
/// Gets the maximum value of a 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>
|
||||
@@ -482,12 +566,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
|
||||
/// Gets the maximum value of a 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>
|
||||
@@ -495,12 +583,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
|
||||
/// Gets the minimum value of a 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>
|
||||
@@ -509,12 +602,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
|
||||
/// Gets the minimum value of a 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>
|
||||
@@ -522,12 +619,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -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)
|
||||
@@ -543,7 +646,7 @@ namespace MongoDbGenericRepository.DataAccess.Read
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -551,35 +654,39 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// </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="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>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// Sums the values of a selected field for a given filtered collection of documents.
|
||||
/// </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="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 />
|
||||
|
||||
@@ -9,12 +9,12 @@ using MongoDbGenericRepository.Models;
|
||||
namespace MongoDbGenericRepository.DataAccess.Update
|
||||
{
|
||||
/// <summary>
|
||||
/// A interface for updating documents in MongoDb.
|
||||
/// A interface for updating documents in MongoDb.
|
||||
/// </summary>
|
||||
public interface IMongoDbUpdater : IDataAccessBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Asynchronously Updates a document.
|
||||
/// 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>
|
||||
@@ -25,19 +25,22 @@ namespace MongoDbGenericRepository.DataAccess.Update
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
|
||||
/// 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">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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the property field with the given value update a property field in entities.
|
||||
/// 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>
|
||||
@@ -46,12 +49,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the property field with the given value update a property field in entities.
|
||||
/// 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>
|
||||
@@ -61,12 +68,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entity selected by the filter, updates the property field with the given value.
|
||||
/// 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>
|
||||
@@ -76,12 +88,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -94,7 +111,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -103,12 +120,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -119,12 +140,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -136,12 +162,18 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -153,12 +185,18 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -169,7 +207,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
|
||||
/// 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>
|
||||
@@ -181,7 +219,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the property field with the given value update a property field in entities.
|
||||
/// 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>
|
||||
@@ -190,12 +228,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the property field with the given value.
|
||||
/// 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>
|
||||
@@ -205,12 +247,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entity selected by the filter, updates the property field with the given value.
|
||||
/// 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>
|
||||
@@ -220,12 +267,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -238,7 +290,7 @@ namespace MongoDbGenericRepository.DataAccess.Update
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -247,12 +299,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -263,12 +319,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -280,12 +341,18 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// Updates a document.
|
||||
/// 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>
|
||||
@@ -297,12 +364,18 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entities selected by the filter, updates the property field with the given value.
|
||||
/// 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>
|
||||
@@ -312,12 +385,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entities selected by the filter, updates the property field with the given value.
|
||||
/// 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>
|
||||
@@ -327,12 +405,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entities selected by the filter, apply the update definition.
|
||||
/// For the entities selected by the filter, apply the update definition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -340,12 +423,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entities selected by the filter, apply the update definition.
|
||||
/// For the entities selected by the filter, apply the update definition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -353,12 +440,16 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entities selected by the filter, updates the property field with the given value.
|
||||
/// 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>
|
||||
@@ -368,12 +459,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entities selected by the filter, updates the property field with the given value.
|
||||
/// 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>
|
||||
@@ -383,12 +479,17 @@ 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>;
|
||||
|
||||
/// <summary>
|
||||
/// For the entities selected by the filter, apply the update definition.
|
||||
/// For the entities selected by the filter, apply the update definition.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
@@ -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,23 +1,26 @@
|
||||
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>
|
||||
{
|
||||
var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id);
|
||||
var updateRes = await HandlePartitioned<TDocument, TKey>(modifiedDocument)
|
||||
.ReplaceOneAsync(session, filter, modifiedDocument, cancellationToken: cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
.ReplaceOneAsync(session, filter, modifiedDocument, cancellationToken: cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
return updateRes.ModifiedCount == 1;
|
||||
}
|
||||
|
||||
@@ -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,40 +65,67 @@ 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>
|
||||
{
|
||||
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
|
||||
var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify)
|
||||
.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return updateRes.ModifiedCount == 1;
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user