added cancellation tokens to sync deletes and added more unit tests
This commit is contained in:
@@ -21,7 +21,7 @@ namespace MongoDbGenericRepository.DataAccess.Delete
|
||||
/// <param name="document">The document you want to delete.</param>
|
||||
/// <param name="cancellationToken">An optional cancellation token</param>
|
||||
/// <returns>The number of documents deleted.</returns>
|
||||
long DeleteOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken = default)
|
||||
long DeleteOne<TDocument, TKey>(TDocument document, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace MongoDbGenericRepository.DataAccess.Delete
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">An optional cancellation token</param>
|
||||
/// <returns>The number of documents deleted.</returns>
|
||||
long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null, CancellationToken cancellationToken = default)
|
||||
long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
@@ -94,8 +94,9 @@ namespace MongoDbGenericRepository.DataAccess.Delete
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="documents">The list of documents to delete.</param>
|
||||
/// <param name="cancellationToken">The cancellation token</param>
|
||||
/// <returns>The number of documents deleted.</returns>
|
||||
long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents)
|
||||
long DeleteMany<TDocument, TKey>(IEnumerable<TDocument> documents, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
@@ -106,8 +107,9 @@ namespace MongoDbGenericRepository.DataAccess.Delete
|
||||
/// <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>
|
||||
/// <returns>The number of documents deleted.</returns>
|
||||
long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)
|
||||
long DeleteMany<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user