Created
January 30, 2018 15:58
-
-
Save mattpodwysocki/ec438ce2c5c5f545bf7f562d7670b973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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