From c1049eb3ffb08e7ec3d4e3747017dbc4c7b8c64f Mon Sep 17 00:00:00 2001 From: skx <610262374@qq.com> Date: Wed, 21 Oct 2020 14:57:42 +0800 Subject: [PATCH] Update SimpleClient --- .../SqlSugar/Interface/ISimpleClient.cs | 42 +++++++++++++++++++ Src/Asp.Net/SqlSugar/SimpleClient.cs | 3 +- Src/Asp.Net/SqlSugar/SqlSugar.csproj | 1 + 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Src/Asp.Net/SqlSugar/Interface/ISimpleClient.cs diff --git a/Src/Asp.Net/SqlSugar/Interface/ISimpleClient.cs b/Src/Asp.Net/SqlSugar/Interface/ISimpleClient.cs new file mode 100644 index 000000000..975b6b628 --- /dev/null +++ b/Src/Asp.Net/SqlSugar/Interface/ISimpleClient.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace SqlSugar +{ + public interface ISimpleClient where T : class, new() + { + IDeleteable AsDeleteable(); + IInsertable AsInsertable(List insertObjs); + IInsertable AsInsertable(T insertObj); + IInsertable AsInsertable(T[] insertObjs); + ISugarQueryable AsQueryable(); + ISqlSugarClient AsSugarClient(); + ITenant AsTenant(); + IUpdateable AsUpdateable(List updateObjs); + IUpdateable AsUpdateable(T updateObj); + IUpdateable AsUpdateable(T[] updateObjs); + int Count(Expression> whereExpression); + bool Delete(Expression> whereExpression); + bool Delete(T deleteObj); + bool DeleteById(dynamic id); + bool DeleteByIds(dynamic[] ids); + T GetById(dynamic id); + List GetList(); + List GetList(Expression> whereExpression); + List GetPageList(Expression> whereExpression, PageModel page); + List GetPageList(Expression> whereExpression, PageModel page, Expression> orderByExpression = null, OrderByType orderByType = OrderByType.Asc); + List GetPageList(List conditionalList, PageModel page); + List GetPageList(List conditionalList, PageModel page, Expression> orderByExpression = null, OrderByType orderByType = OrderByType.Asc); + T GetSingle(Expression> whereExpression); + bool Insert(T insertObj); + bool InsertRange(List insertObjs); + bool InsertRange(T[] insertObjs); + int InsertReturnIdentity(T insertObj); + bool IsAny(Expression> whereExpression); + bool Update(Expression> columns, Expression> whereExpression); + bool Update(T updateObj); + bool UpdateRange(List updateObjs); + bool UpdateRange(T[] updateObjs); + } +} \ No newline at end of file diff --git a/Src/Asp.Net/SqlSugar/SimpleClient.cs b/Src/Asp.Net/SqlSugar/SimpleClient.cs index 909221adc..3b0a7a3a4 100644 --- a/Src/Asp.Net/SqlSugar/SimpleClient.cs +++ b/Src/Asp.Net/SqlSugar/SimpleClient.cs @@ -7,7 +7,7 @@ using System.Text; namespace SqlSugar { - public partial class SimpleClient where T : class, new() + public partial class SimpleClient : ISimpleClient where T : class, new() { protected ISqlSugarClient Context { get; set; } @@ -171,6 +171,7 @@ namespace SqlSugar } + [Obsolete("Use SimpleClient")] public partial class SimpleClient { protected ISqlSugarClient Context { get; set; } diff --git a/Src/Asp.Net/SqlSugar/SqlSugar.csproj b/Src/Asp.Net/SqlSugar/SqlSugar.csproj index 01489be41..47a710c4f 100644 --- a/Src/Asp.Net/SqlSugar/SqlSugar.csproj +++ b/Src/Asp.Net/SqlSugar/SqlSugar.csproj @@ -134,6 +134,7 @@ +