using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace APT.Infrastructure.Core
{
public interface IRepository : IDependInject
{
#region properties
///
/// 获取 当前单元操作对象
///
IUnitOfWork UnitOfWork { get; }
#endregion
#region methods
void AddEntity(T entity, bool isSave = true) where T : MesEntityBase, new();
T AddAndGetEntity(T entity, bool isSave = true) where T : MesEntityBase, new();
void AddEntities(IEnumerable entities, bool isSave = true) where T : MesEntityBase, new();
void DeleteEntity(T entity, bool isSave = true) where T : MesEntityBase, new();
void DeleteEntity(Guid key, bool isSave = true) where T : MesEntityBase, new();
void DeleteEntity(Expression> predicate, bool isSave = true) where T : MesEntityBase, new();
void DeleteEntities(IEnumerable entities, bool isSave = true) where T : MesEntityBase, new();
bool UpdateEntity(T entity, bool isSave = true, params string[] updateField) where T : MesEntityBase, new();
void UpdateEntities(IEnumerable entities, bool isSave = true, params string[] updateField) where T : MesEntityBase, new();
void SaveEntities(IEnumerable entities, bool isSave = true) where T : MesEntityBase, new();
T GetEntity(Guid id, params string[] paths)
where T : MesEntityBase, new();
T GetEntity(Expression> expression, BaseFilter filter, params string[] paths)
where T : MesEntityBase, new();
T GetEntity(Expression> expression, BaseFilter filter, bool isTracking = true, params string[] paths)
where T : MesEntityBase, new();
T GetEntityByRedis(string key, Guid orgid) where T : MesEntityBase, new();
Task> GetEntitiesByRedis(BaseFilter filter) where T : MesEntityBase, new();
List GetEntitiesByRedis(Expression> expression, BaseFilter filter) where T : MesEntityBase, new();
Task> GetEntitiesTableByRedis(Expression> expression, BaseFilter filter,
params string[] paths) where T : MesEntityBase, new();
Task> GetEntitiesByRedis(Expression> expression, BaseFilter filter, string groupValue,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageByRedis(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
T GetEntityByRedis(Guid key, Guid orgid) where T : MesEntityBase, new();
Task> GetEntitiesByGroupRedis(BaseFilter filter, string groupValue) where T : MesEntityBase, new();
IEnumerable GetEntities(Expression> expression, BaseFilter filter,
params string[] paths) where T : MesEntityBase, new();
IEnumerable GetEntities(Expression> expression, BaseFilter filter,
bool isTracking = true, params string[] paths) where T : MesEntityBase, new();
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter,
params string[] paths) where T : MesEntityBase, new();
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter,
bool isTracking = true, params string[] paths) where T : MesEntityBase, new();
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter, Dictionary orders,
bool isTracking = true, params string[] paths) where T : MesEntityBase, new();
IEnumerable GetOrderEntities(Expression> expression, BaseFilter filter, Dictionary orders,
Action> orderBy,
bool isTracking = true, params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetPageEntities(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex, bool isTracking = true,
params string[] paths) where T : MesEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, bool isTracking = true,
params string[] paths) where T : MesEntityBase, new();
IEnumerable> GetTreeOrderEntities(Expression> expression, BaseFilter filter, bool isTracking = true,
params string[] paths) where T : TreeEntityBase, new();
IEnumerable GetTree(string id, bool containCurrent = true, BaseFilter filter = null,
params string[] paths) where T : TreeEntityBase, new();
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, Action> orderBy, bool isTracking = true,
params string[] paths) where T : MesEntityBase, new();
//
PagedResultDto GetOrderPageEntities(Expression> expression, BasePageFilter pageFilter,
string[] selectField, params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
int pageSize, int startIndex, bool isTracking = true,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, bool isTracking = true,
params string[] paths) where T : MesEntityBase, new();
Task> GetOrderPageEntitiesSync(Expression> expression, BasePageFilter pageFilter,
Dictionary orders,
int pageSize, int startIndex, Action> orderBy, bool isTracking = true,
params string[] paths) where T : MesEntityBase, new();
int GetCount(Expression> expression, BaseFilter filter) where T : MesEntityBase, new();
bool IsAny(Expression> expression, BaseFilter filter) where T : MesEntityBase, new();
#endregion
///
/// 填充系统参数
///
///
///
///
void FillGetEntitySysParam(IEnumerable entities, BaseFilter filter, string[] includes);
T AddAndGetEntity_noneBase(T entity) where T : class;
void AddEntities_noneBase(IEnumerable entities) where T : class;
T GetEntity_noneBase(Expression> expressions) where T : class;
List GetEntities_noneBase(Expression> expressions) where T : class;
void UpdateEntities_noneBase(IEnumerable entities) where T : class;
void DeleteEntity_noneBase(Expression> expression) where T : class;
#region nocomit
void AddEntityNoCommit(T entity) where T : MesEntityBase, new();
void AddEntitiesNoCommit(IEnumerable entities) where T : MesEntityBase, new();
void UpdateEntitiesNoCommit(IEnumerable entities) where T : MesEntityBase, new();
bool UpdateEntityNoCommit(T entity, params string[] updateField) where T : MesEntityBase, new();
void UpdateEntitiesNoCommit(IEnumerable entities, params string[] updateField) where T : MesEntityBase, new();
void DeleteEntityNoCommit(Expression> expression) where T : MesEntityBase, new();
void DeleteEntityNoCommit(T entity) where T : MesEntityBase, new();
void DeleteEntityNoCommit(Guid id) where T : MesEntityBase, new();
void DeleteEntitiesNoCommit(IEnumerable entities) where T : MesEntityBase, new();
void SaveEntitiesNoCommit(IEnumerable entities) where T : MesEntityBase, new();
T AddAndGetEntityNoCommit(T entity) where T : MesEntityBase, new();
void AddEntityByConn(T entity, string conn) where T : MesEntityBase, new();
void UpdateEntitiesByConn(IEnumerable entities, string conn) where T : MesEntityBase, new();
void UpdateEntityByConn(T entity, string conn, params string[] updateField) where T : MesEntityBase, new();
void DeleteEntityByConn(Expression> expression, string conn) where T : MesEntityBase, new();
void DeleteEntityByConn(T entity, string conn) where T : MesEntityBase, new();
void DeleteEntityByConn(Guid id, string conn) where T : MesEntityBase, new();
void DeleteEntitiesByConn(IEnumerable entities, string conn) where T : MesEntityBase, new();
void AddEntitiesByConn(IEnumerable entities, string conn) where T : MesEntityBase, new();
void UpdateEntitiesByConn(IEnumerable entities, string conn, params string[] updateField) where T : MesEntityBase, new();
//Tenant
void AddEntityByTenant(T entity, string Tenant) where T : MesEntityBase, new();
void UpdateEntitiesByTenant(IEnumerable entities, string Tenant) where T : MesEntityBase, new();
void UpdateEntityByTenant(T entity, string Tenant, params string[] updateField) where T : MesEntityBase, new();
void DeleteEntityByTenant(Expression> expression, string Tenant) where T : MesEntityBase, new();
void DeleteEntityByTenant(T entity, string Tenant) where T : MesEntityBase, new();
void DeleteEntityByTenant(Guid id, string Tenant) where T : MesEntityBase, new();
void DeleteEntitiesByTenant(IEnumerable entities, string Tenant) where T : MesEntityBase, new();
void AddEntitiesByTenant(IEnumerable entities, string Tenant) where T : MesEntityBase, new();
void UpdateEntitiesByTenant(IEnumerable entities, string Tenant, params string[] updateField) where T : MesEntityBase, new();
#endregion
}
}