Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public interface IDataRepository<TEntity> : IDisposable where TEntity : class
{
ICollection<TEntity> Find(
Expression<Func<TEntity, bool>> criteria,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = "");
Task<ICollection<TEntity>> FindAsync(
Expression<Func<TEntity, bool>> criteria,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = "");
Task<ICollection<TEntity>> FindAsync(
CancellationToken cancellationToken,
Expression<Func<TEntity, bool>> criteria,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = "");
TEntity FindById(params object[] keyValues);
Task<TEntity> FindByIdAsync(params object[] keyValues);
Task<TEntity> FindByIdAsync(CancellationToken cancellationToken, params object[] keyValues);
void Delete(TEntity entity);
bool Delete(params object[] keyValues);
Task<bool> DeleteAsync(params object[] keyValues);
Task<bool> DeleteAsync(CancellationToken cancellationToken, params object[] keyValues);
void Insert(TEntity entity);
void Update(TEntity entity);
}
public interface IUnitOfWork
{
IDataRepository<TEntity> Repository<TEntity>() where TEntity : class;
int Save();
Task<int> SaveAsync();
Task<int> SaveAsync(CancellationToken cancellationToken);
void BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.Unspecified);
bool Commit();
void Rollback();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.