using System; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using MongoDB.Driver; using MongoDbGenericRepository.Models; namespace MongoDbGenericRepository.DataAccess.Update { /// /// The IBaseMongoRepository_Update_ClientSession interface exposing update functionality with a IClientSessionHandle. /// public interface IBaseMongoRepository_Update_ClientSession { /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type of the field to update. /// The client session. /// The filter for the update. /// The field to update. /// The value of the field. /// The optional partition key. /// The optional cancellation token. /// A boolean value indicating success. bool UpdateOne(IClientSessionHandle session, Expression> filter, Expression> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type of the field to update. /// The client session. /// The filter for the update. /// The field to update. /// The value of the field. /// The optional partition key. /// The optional cancellation token. /// A boolean value indicating success. bool UpdateOne(IClientSessionHandle session, FilterDefinition filter, Expression> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type of the field to update. /// The client session. /// The document to modify. /// The field to update. /// The value of the field. /// The optional cancellation token. /// A boolean value indicating success. bool UpdateOne(IClientSessionHandle session, TDocument documentToModify, Expression> field, TField value, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The client session. /// The document with the modifications you want to persist. /// The optional cancellation token. /// A boolean value indicating success. bool UpdateOne(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The client session. /// The document to modify. /// The update definition. /// The optional cancellation token. /// A boolean value indicating success. bool UpdateOne(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition update, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type of the field to update. /// The client session. /// The filter for the update. /// The field to update. /// The value of the field. /// The optional partition key. /// The optional cancellation token. /// A boolean value indicating success. Task UpdateOneAsync(IClientSessionHandle session, Expression> filter, Expression> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type of the field to update. /// The client session. /// The filter for the update. /// The field to update. /// The value of the field. /// The optional partition key. /// The optional cancellation token. /// Task UpdateOneAsync(IClientSessionHandle session, FilterDefinition filter, Expression> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The type of the field to update. /// The client session. /// The document to modify. /// The field to update. /// The value of the field. /// The optional cancellation token. /// A boolean value indicating success. Task UpdateOneAsync(IClientSessionHandle session, TDocument documentToModify, Expression> field, TField value, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The client session. /// The document with the modifications you want to persist. /// The optional cancellation token. /// A boolean value indicating success. Task UpdateOneAsync(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; /// /// Updates a document. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The client session. /// The document to modify. /// The update definition. /// The optional cancellation token. /// A boolean value indicating success. Task UpdateOneAsync(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition update, CancellationToken cancellationToken = default(CancellationToken)) where TDocument : IDocument where TKey : IEquatable; } }