You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Entities/Storage/IStorage.cs

33 lines
1.2 KiB

2 years ago
using System.Collections;
using System.Collections.Immutable;
using System.Data;
namespace Connected.Entities.Storage;
/// <summary>
/// Defines the read and write operations on the supported storage providers.
/// </summary>
/// <typeparam name="TEntity">>The type of the entitiy on which operations are performed.</typeparam>
public interface IStorage<TEntity> : IQueryable<TEntity>, IQueryable, IEnumerable<TEntity>, IEnumerable, IOrderedQueryable<TEntity>, IOrderedQueryable
where TEntity : IEntity
{
/// <summary>
/// Updates the entity against the underlying storage.
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<TEntity> Update(TEntity? entity);
Task<TEntity> Update<TArgs>(TEntity? entity, TArgs args, Func<Task<TEntity?>>? concurrencyRetrying)
where TArgs : IDto;
Task<TEntity> Update<TArgs>(TEntity? entity, TArgs args, Func<Task<TEntity?>>? concurrencyRetrying, Func<TEntity, Task<TEntity>>? merging)
where TArgs : IDto;
Task<ImmutableList<IDataReader>> OpenReaders(StorageContextArgs args);
Task<int> Execute(StorageContextArgs args);
Task<IEnumerable<TEntity>> Query(StorageContextArgs args);
Task<TEntity?> Select(StorageContextArgs args);
}