SqlSugar/Src/Asp.Net/SqlSugar/Interface/ISimpleClient.cs

94 lines
5.0 KiB
C#
Raw Normal View History

2020-10-21 14:57:42 +08:00
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
2020-10-21 15:26:14 +08:00
using System.Threading.Tasks;
2020-10-21 14:57:42 +08:00
namespace SqlSugar
{
public interface ISimpleClient<T> where T : class, new()
{
2021-01-07 23:31:21 +08:00
SimpleClient<ChangeType> Change<ChangeType>() where ChangeType : class, new();
2021-04-06 21:21:46 +08:00
RepositoryType ChangeRepository<RepositoryType>() where RepositoryType : ISugarRepository ;
2020-10-21 14:57:42 +08:00
IDeleteable<T> AsDeleteable();
IInsertable<T> AsInsertable(List<T> insertObjs);
IInsertable<T> AsInsertable(T insertObj);
IInsertable<T> AsInsertable(T[] insertObjs);
ISugarQueryable<T> AsQueryable();
ISqlSugarClient AsSugarClient();
ITenant AsTenant();
IUpdateable<T> AsUpdateable(List<T> updateObjs);
IUpdateable<T> AsUpdateable(T updateObj);
2021-11-10 12:49:44 +08:00
IUpdateable<T> AsUpdateable();
2020-10-21 14:57:42 +08:00
IUpdateable<T> AsUpdateable(T[] updateObjs);
int Count(Expression<Func<T, bool>> whereExpression);
bool Delete(Expression<Func<T, bool>> whereExpression);
bool Delete(T deleteObj);
2022-04-29 14:22:40 +08:00
bool Delete(List<T> deleteObjs);
2020-10-21 14:57:42 +08:00
bool DeleteById(dynamic id);
bool DeleteByIds(dynamic[] ids);
T GetById(dynamic id);
List<T> GetList();
List<T> GetList(Expression<Func<T, bool>> whereExpression);
List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page);
List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page);
List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
T GetSingle(Expression<Func<T, bool>> whereExpression);
2021-10-06 15:09:52 +08:00
T GetFirst(Expression<Func<T, bool>> whereExpression);
2020-10-21 14:57:42 +08:00
bool Insert(T insertObj);
2022-06-14 18:01:43 +08:00
bool InsertOrUpdate(T data);
bool InsertOrUpdate(List<T> datas);
2020-10-21 14:57:42 +08:00
bool InsertRange(List<T> insertObjs);
bool InsertRange(T[] insertObjs);
int InsertReturnIdentity(T insertObj);
2021-01-16 14:41:58 +08:00
long InsertReturnBigIdentity(T insertObj);
2021-07-31 21:38:05 +08:00
long InsertReturnSnowflakeId(T insertObj);
List<long> InsertReturnSnowflakeId(List<T> insertObjs);
2022-09-10 21:12:30 +08:00
T InsertReturnEntity(T insertObj);
2021-07-31 21:38:05 +08:00
2020-10-21 14:57:42 +08:00
bool IsAny(Expression<Func<T, bool>> whereExpression);
bool Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
2022-09-29 20:50:32 +08:00
bool UpdateSetColumnsTrue(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
2020-10-21 14:57:42 +08:00
bool Update(T updateObj);
bool UpdateRange(List<T> updateObjs);
bool UpdateRange(T[] updateObjs);
2020-10-21 15:26:14 +08:00
Task<int> CountAsync(Expression<Func<T, bool>> whereExpression);
Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
Task<bool> DeleteAsync(T deleteObj);
2022-04-29 14:22:40 +08:00
Task<bool> DeleteAsync(List<T> deleteObjs);
2020-10-21 15:26:14 +08:00
Task<bool> DeleteByIdAsync(dynamic id);
Task<bool> DeleteByIdsAsync(dynamic[] ids);
Task<T> GetByIdAsync(dynamic id);
Task<List<T>> GetListAsync();
Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page);
Task<List<T>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
Task<List<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page);
Task<List<T>> GetPageListAsync(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
2021-10-06 15:09:52 +08:00
Task<T> GetFirstAsync(Expression<Func<T, bool>> whereExpression);
2020-10-21 15:26:14 +08:00
Task<bool> InsertAsync(T insertObj);
2022-06-14 18:01:43 +08:00
Task<bool> InsertOrUpdateAsync(T data);
Task<bool> InsertOrUpdateAsync(List<T> datas);
2020-10-21 15:26:14 +08:00
Task<bool> InsertRangeAsync(List<T> insertObjs);
Task<bool> InsertRangeAsync(T[] insertObjs);
Task<int> InsertReturnIdentityAsync(T insertObj);
2021-01-16 14:41:58 +08:00
Task<long> InsertReturnBigIdentityAsync(T insertObj);
2021-07-31 21:38:05 +08:00
Task<long> InsertReturnSnowflakeIdAsync(T insertObj);
Task<List<long>> InsertReturnSnowflakeIdAsync(List<T> insertObjs);
2022-09-10 21:12:30 +08:00
Task<T> InsertReturnEntityAsync(T insertObj);
2021-07-31 21:38:05 +08:00
2020-10-21 15:26:14 +08:00
Task<bool> IsAnyAsync(Expression<Func<T, bool>> whereExpression);
2022-09-29 20:50:32 +08:00
Task<bool> UpdateSetColumnsTrueAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
2020-10-21 15:26:14 +08:00
Task<bool> UpdateAsync(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
Task<bool> UpdateAsync(T updateObj);
Task<bool> UpdateRangeAsync(List<T> updateObjs);
Task<bool> UpdateRangeAsync(T[] updateObjs);
2020-10-21 14:57:42 +08:00
}
}