using System.Linq.Expressions; using Microsoft.EntityFrameworkCore.Query; #if NETFRAMEWORK using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Linq; #endif namespace DigitalData.Core.Abstraction.Application.Repository { public interface IRepository { #if NET public #endif Task ExecuteSqlRawAsync([NotParameterized] string sql, IEnumerable parameters, CancellationToken cancel = default); #if NET public #endif Task ExecuteSqlInterpolatedAsync(FormattableString sql, CancellationToken cancel = default); #if NET public #endif int ExecuteSqlRaw([NotParameterized] string sql, params object[] parameters); #if NET public #endif int ExecuteSqlInterpolated(FormattableString sql); } public interface IRepository { #region Create #if NET public #endif Task CreateAsync(TEntity entity, CancellationToken cancel = default); #if NET public #endif Task> CreateAsync(IEnumerable entities, CancellationToken cancel = default); #if NET public #endif Task CreateAsync(TDto dto, CancellationToken cancel = default); #if NET public #endif Task> CreateAsync(IEnumerable dtos, CancellationToken cancel = default); #endregion Create #region Read #if NET public #endif IQueryable Query { get; } #if NET public #endif IQueryable Where(Expression> expression); #if NET public #endif IEnumerable GetAll(); #if NET public #endif Task> GetAllAsync(CancellationToken cancel = default); #endregion Read #region Update #if NET public #endif Task UpdateAsync(TDto dto, Expression> expression, CancellationToken cancel = default); #if NET public #endif Task UpdateAsync(TDto dto, Func, IQueryable> query, CancellationToken cancel = default); #if NET public #endif Task UpdateAsync(Action modification, Func, IQueryable> query, CancellationToken cancel = default); #if NET public #endif Task UpdateAsync(Action modification, Expression> expression, CancellationToken cancel = default); #endregion Update #region Delete #if NET public #endif Task DeleteAsync(Expression> expression, CancellationToken cancel = default); #if NET public #endif Task DeleteAsync(Func, IQueryable> query, CancellationToken cancel = default); #endregion Delete #region Obsolete [Obsolete("Use CreateAsync, UpdateAsync or DeleteAsync")] #if NET public #endif IQueryable Read(); [Obsolete("Use IRepository.Where")] #if NET public #endif IQueryable ReadOnly(); #endregion } }