using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MongoDbGenericRepository.DataAccess.Base; using MongoDbGenericRepository.Models; namespace MongoDbGenericRepository.DataAccess.Create { /// /// A interface for adding documents to the Database and its Collections. /// public interface IMongoDbCreator : IDataAccessBase { /// /// Asynchronously adds a document to the collection. /// Populates the Id and AddedAtUtc fields if necessary. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The document you want to add. /// An optional cancellation Token. Task AddOneAsync(TDocument document, CancellationToken cancellationToken = default) where TDocument : IDocument where TKey : IEquatable; /// /// Adds a document to the collection. /// Populates the Id and AddedAtUtc fields if necessary. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The document you want to add. /// An optional cancellation Token. void AddOne(TDocument document, CancellationToken cancellationToken = default) where TDocument : IDocument where TKey : IEquatable; /// /// Asynchronously adds a list of documents to the collection. /// Populates the Id and AddedAtUtc fields if necessary. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The documents you want to add. /// An optional cancellation Token. Task AddManyAsync(IEnumerable documents, CancellationToken cancellationToken = default) where TDocument : IDocument where TKey : IEquatable; /// /// Adds a list of documents to the collection. /// Populates the Id and AddedAtUtc fields if necessary. /// /// The type representing a Document. /// The type of the primary key for a Document. /// The documents you want to add. /// An optional cancellation Token. void AddMany(IEnumerable documents, CancellationToken cancellationToken = default) where TDocument : IDocument where TKey : IEquatable; } }