/// <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="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> public virtual async Task <bool> UpdateOneOptimisticAsync <TDocument, TField>(TDocument documentToModify, Expression <Func <TDocument, TField> > field, TField value) where TDocument : IDocument <Guid> { return(await MongoDbUpdater.UpdateOneOptimisticAsync <TDocument, Guid, TField>(documentToModify, field, value)); }
/// <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> /// <param name="documentToModify">The document you want to modify.</param> /// <param name="update">The update definition for the document.</param> public virtual async Task <bool> UpdateOneOptimisticAsync <TDocument>(TDocument documentToModify, UpdateDefinition <TDocument> update) where TDocument : IDocument <Guid> { return(await MongoDbUpdater.UpdateOneOptimisticAsync <TDocument, Guid>(documentToModify, update)); }
/// <summary> /// Takes a document you want to modify and applies the update you have defined in MongoDb with lock. /// </summary> /// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <param name="documentToModify">The document you want to modify.</param> /// <param name="update">The update definition for the document.</param> public virtual bool UpdateOneOptimistic <TDocument>(TDocument documentToModify, UpdateDefinition <TDocument> update) where TDocument : IDocument <Guid> { return(MongoDbUpdater.UpdateOneOptimistic <TDocument, Guid>(documentToModify, update)); }
/// <summary> /// Asynchronously Updates a document with lock. /// </summary> /// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <param name="modifiedDocument">The document with the modifications you want to persist.</param> public virtual async Task <bool> UpdateOneOptimisticAsync <TDocument>(TDocument modifiedDocument) where TDocument : IDocument <Guid> { return(await MongoDbUpdater.UpdateOneOptimisticAsync <TDocument, Guid>(modifiedDocument)); }
/// <summary> /// Updates a document with lock. /// </summary> /// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <param name="modifiedDocument">The document with the modifications you want to persist.</param> public virtual bool UpdateOneOptimistic <TDocument>(TDocument modifiedDocument) where TDocument : IDocument <Guid> { return(MongoDbUpdater.UpdateOneOptimistic <TDocument, Guid>(modifiedDocument)); }
/// <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> /// <typeparam name="TField">The type of the field to update.</typeparam> /// <param name="session">The client session.</param> /// <param name="documentToModify">The document to modify.</param> /// <param name="field">The field to update.</param> /// <param name="value">The value of the field.</param> /// <param name="cancellationToken">The optional cancellation token.</param> /// <returns>A boolean value indicating success.</returns> public virtual async Task <bool> UpdateOneAsync <TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression <Func <TDocument, TField> > field, TField value, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument <TKey> where TKey : IEquatable <TKey> { return(await MongoDbUpdater.UpdateOneAsync <TDocument, TKey, TField>(session, documentToModify, field, value, cancellationToken)); }
/// <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="session">The client session.</param> /// <param name="documentToModify">The document to modify.</param> /// <param name="update">The update definition.</param> /// <param name="cancellationToken">The optional cancellation token.</param> /// <returns>A boolean value indicating success.</returns> public virtual bool UpdateOne <TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition <TDocument> update, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument <TKey> where TKey : IEquatable <TKey> { return(MongoDbUpdater.UpdateOne <TDocument, TKey>(session, documentToModify, update, cancellationToken)); }
/// <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="session">The client session.</param> /// <param name="modifiedDocument">The document with the modifications you want to persist.</param> /// <param name="cancellationToken">The optional cancellation token.</param> /// <returns>A boolean value indicating success.</returns> public virtual bool UpdateOne <TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument <TKey> where TKey : IEquatable <TKey> { return(MongoDbUpdater.UpdateOne <TDocument, TKey>(session, modifiedDocument, cancellationToken)); }
/// <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> /// <typeparam name="TField">The type of the field to update.</typeparam> /// <param name="session">The client session.</param> /// <param name="filter">The filter for the update.</param> /// <param name="field">The field to update.</param> /// <param name="value">The value of the field.</param> /// <param name="partitionKey">The optional partition key.</param> /// <param name="cancellationToken">The optional cancellation token.</param> /// <returns>A boolean value indicating success.</returns> 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(CancellationToken)) where TDocument : IDocument <TKey> where TKey : IEquatable <TKey> { return(MongoDbUpdater.UpdateOne <TDocument, TKey, TField>(session, filter, field, value, partitionKey, cancellationToken)); }
public BaseMongoRepositoryUpdate(MongoDbUpdater mongoDbUpdater) { _mongoDbUpdater = mongoDbUpdater; }