Interface IRepository<TEntity, TPrimaryKey>
- Namespace
- H.Extensions.DataBase
- Assembly
- H.Extensions.DataBase.dll
public interface IRepository<TEntity, TPrimaryKey> : IRepository where TEntity : EntityBase<TPrimaryKey>
Type Parameters
TEntity
TPrimaryKey
- Extension Methods
-
Methods
Clear(bool)
int Clear(bool autoSave = true)
Parameters
autoSave
bool
Returns
- int
ClearAsync(bool)
Task<int> ClearAsync(bool autoSave = true)
Parameters
autoSave
bool
Returns
- Task<int>
Delete(TEntity, bool)
int Delete(TEntity entity, bool autoSave = true)
Parameters
entity
TEntity
autoSave
bool
Returns
- int
DeleteAsync(Expression<Func<TEntity, bool>>, bool)
Task<int> DeleteAsync(Expression<Func<TEntity, bool>> where, bool autoSave = true)
Parameters
where
Expression<Func<TEntity, bool>>
autoSave
bool
Returns
- Task<int>
DeleteAsync(TEntity, bool)
Task<int> DeleteAsync(TEntity entity, bool autoSave = true)
Parameters
entity
TEntity
autoSave
bool
Returns
- Task<int>
DeleteByID(TPrimaryKey, bool)
int DeleteByID(TPrimaryKey id, bool autoSave = true)
Parameters
id
TPrimaryKey
autoSave
bool
Returns
- int
DeleteByIDAsync(TPrimaryKey, bool)
Task<int> DeleteByIDAsync(TPrimaryKey id, bool autoSave = true)
Parameters
id
TPrimaryKey
autoSave
bool
Returns
- Task<int>
FirstOrDefaultAsync(Expression<Func<TEntity, bool>>)
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> predicate)
Parameters
predicate
Expression<Func<TEntity, bool>>
Returns
- Task<TEntity>
GetByIDAsync(TPrimaryKey)
Task<TEntity> GetByIDAsync(TPrimaryKey id)
Parameters
id
TPrimaryKey
Returns
- Task<TEntity>
GetList()
Returns
- List<TEntity>
GetList(Action<IQueryable<TEntity>>)
List<TEntity> GetList(Action<IQueryable<TEntity>> action)
Parameters
action
Action<IQueryable<TEntity>>
Returns
- List<TEntity>
GetList(Expression<Func<TEntity, bool>>)
List<TEntity> GetList(Expression<Func<TEntity, bool>> predicate)
Parameters
predicate
Expression<Func<TEntity, bool>>
Returns
- List<TEntity>
GetList(params string[])
List<TEntity> GetList(params string[] includes)
Parameters
includes
string[]
Returns
- List<TEntity>
GetListAsync()
Task<List<TEntity>> GetListAsync()
Returns
- Task<List<TEntity>>
GetListAsync(Expression<Func<TEntity, bool>>)
Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate)
Parameters
predicate
Expression<Func<TEntity, bool>>
Returns
- Task<List<TEntity>>
GetListAsync(params string[])
Task<List<TEntity>> GetListAsync(params string[] includes)
Parameters
includes
string[]
Returns
- Task<List<TEntity>>
Insert(TEntity, bool)
int Insert(TEntity entity, bool autoSave = true)
Parameters
entity
TEntity
autoSave
bool
Returns
- int
InsertAsync(TEntity, bool)
Task<int> InsertAsync(TEntity entity, bool autoSave = true)
Parameters
entity
TEntity
autoSave
bool
Returns
- Task<int>
InsertOrUpdateAsync(TEntity, bool)
Task<int> InsertOrUpdateAsync(TEntity entity, bool autoSave = true)
Parameters
entity
TEntity
autoSave
bool
Returns
- Task<int>
InsertRangeAsync(params TEntity[])
Task<int> InsertRangeAsync(params TEntity[] entity)
Parameters
entity
TEntity[]
Returns
- Task<int>
LoadPageList(int, int, Expression<Func<TEntity, bool>>, Expression<Func<TEntity, object>>)
Task<Tuple<List<TEntity>, int>> LoadPageList(int startPage, int pageSizet, Expression<Func<TEntity, bool>> where = null, Expression<Func<TEntity, object>> order = null)
Parameters
startPage
int
pageSizet
int
where
Expression<Func<TEntity, bool>>
order
Expression<Func<TEntity, object>>
Returns
- Task<Tuple<List<TEntity>, int>>
Save()
Returns
- int
SaveAsync()
Returns
- Task<int>
Update(TEntity, bool)
int Update(TEntity entity, bool autoSave = true)
Parameters
entity
TEntity
autoSave
bool
Returns
- int
UpdateAsync(TEntity, bool)
Task<int> UpdateAsync(TEntity entity, bool autoSave = true)
Parameters
entity
TEntity
autoSave
bool
Returns
- Task<int>