From baadbeb99d8f18df06b40989c856f44b8fa1817a Mon Sep 17 00:00:00 2001 From: SUNKAIXUAN <610262374@qq.com> Date: Thu, 1 Apr 2021 15:50:09 +0800 Subject: [PATCH] Delete obsolete --- .../SugarProvider/SqlSugarAccessory.cs | 2 +- .../SugarProvider/SqlSugarProvider.cs | 20 +-- Src/Asp.Net/SqlSugar/SimpleClient.cs | 127 ------------------ 3 files changed, 11 insertions(+), 138 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs index b5af401cf..10c0e6268 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs @@ -46,7 +46,7 @@ namespace SqlSugar protected IContextMethods _RewritableMethods; protected IDbMaintenance _DbMaintenance; protected QueryFilterProvider _QueryFilterProvider; - protected SimpleClient _SimpleClient; + //protected SimpleClient _SimpleClient; protected IAdo ContextAdo { get diff --git a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs index 2e23d2b12..31b3b587f 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs @@ -828,16 +828,16 @@ namespace SqlSugar #endregion #region SimpleClient - [Obsolete("Use SqlSugarClient.GetSimpleClient() Or SqlSugarClient.GetSimpleClient() ")] - public virtual SimpleClient SimpleClient - { - get - { - if (this._SimpleClient == null) - this._SimpleClient = new SimpleClient(this); - return this._SimpleClient; - } - } + //[Obsolete("Use SqlSugarClient.GetSimpleClient() Or SqlSugarClient.GetSimpleClient() ")] + //public virtual SimpleClient SimpleClient + //{ + // get + // { + // if (this._SimpleClient == null) + // this._SimpleClient = new SimpleClient(this); + // return this._SimpleClient; + // } + //} public virtual SimpleClient GetSimpleClient() where T : class, new() { return new SimpleClient(this); diff --git a/Src/Asp.Net/SqlSugar/SimpleClient.cs b/Src/Asp.Net/SqlSugar/SimpleClient.cs index 0fe5eee97..7a4be1987 100644 --- a/Src/Asp.Net/SqlSugar/SimpleClient.cs +++ b/Src/Asp.Net/SqlSugar/SimpleClient.cs @@ -291,131 +291,4 @@ namespace SqlSugar [Obsolete("Use AsSugarClient()")] public ISqlSugarClient FullClient { get { return this.Context; } } } - - - [Obsolete("Use SimpleClient")] - public partial class SimpleClient - { - protected ISqlSugarClient Context { get; set; } - public ITenant AsTenant() - { - return this.Context as ITenant; - } - public ISqlSugarClient AsSugarClient() - { - return this.Context; - } - - private SimpleClient() - { - - } - public SimpleClient(ISqlSugarClient context) - { - this.Context = context; - } - - public T GetById(dynamic id) where T : class, new() - { - return Context.Queryable().InSingle(id); - } - public int Count(Expression> whereExpression) - { - return Context.Queryable().Where(whereExpression).Count(); - } - public List GetList() where T : class, new() - { - return Context.Queryable().ToList(); - } - public T GetSingle(Expression> whereExpression) where T : class, new() - { - return Context.Queryable().Single(whereExpression); - } - public List GetList(Expression> whereExpression) where T : class, new() - { - return Context.Queryable().Where(whereExpression).ToList(); - } - public List GetPageList(Expression> whereExpression, PageModel page) where T : class, new() - { - int count = 0; - var result = Context.Queryable().Where(whereExpression).ToPageList(page.PageIndex, page.PageSize, ref count); - page.PageCount = count; - return result; - } - public List GetPageList(Expression> whereExpression, PageModel page, Expression> orderByExpression = null, OrderByType orderByType = OrderByType.Asc) where T : class, new() - { - int count = 0; - var result = Context.Queryable().OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(whereExpression).ToPageList(page.PageIndex, page.PageSize, ref count); - page.PageCount = count; - return result; - } - public List GetPageList(List conditionalList, PageModel page) where T : class, new() - { - int count = 0; - var result = Context.Queryable().Where(conditionalList).ToPageList(page.PageIndex, page.PageSize, ref count); - page.PageCount = count; - return result; - } - public List GetPageList(List conditionalList, PageModel page, Expression> orderByExpression = null, OrderByType orderByType = OrderByType.Asc) where T : class, new() - { - int count = 0; - var result = Context.Queryable().OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(conditionalList).ToPageList(page.PageIndex, page.PageSize, ref count); - page.PageCount = count; - return result; - } - public bool IsAny(Expression> whereExpression) where T : class, new() - { - return Context.Queryable().Where(whereExpression).Any(); - } - public bool Insert(T insertObj) where T : class, new() - { - return this.Context.Insertable(insertObj).ExecuteCommand() > 0; - } - public int InsertReturnIdentity(T insertObj) where T : class, new() - { - return this.Context.Insertable(insertObj).ExecuteReturnIdentity(); - } - public bool InsertRange(T[] insertObjs) where T : class, new() - { - return this.Context.Insertable(insertObjs).ExecuteCommand() > 0; - } - public bool InsertRange(List insertObjs) where T : class, new() - { - return this.Context.Insertable(insertObjs).ExecuteCommand() > 0; - } - public bool Update(T updateObj) where T : class, new() - { - return this.Context.Updateable(updateObj).ExecuteCommand() > 0; - } - public bool UpdateRange(T[] updateObjs) where T : class, new() - { - return this.Context.Updateable(updateObjs).ExecuteCommand() > 0; - } - public bool UpdateRange(List updateObjs) where T : class, new() - { - return this.Context.Updateable(updateObjs).ExecuteCommand() > 0; - } - public bool Update(Expression> columns, Expression> whereExpression) where T : class, new() - { - return this.Context.Updateable(columns).Where(whereExpression).ExecuteCommand() > 0; - } - public bool Delete(T deleteObj) where T : class, new() - { - return this.Context.Deleteable().Where(deleteObj).ExecuteCommand() > 0; - } - public bool Delete(Expression> whereExpression) where T : class, new() - { - return this.Context.Deleteable().Where(whereExpression).ExecuteCommand() > 0; - } - public bool DeleteById(dynamic id) where T : class, new() - { - return this.Context.Deleteable().In(id).ExecuteCommand() > 0; - } - public bool DeleteByIds(dynamic[] ids) where T : class, new() - { - return this.Context.Deleteable().In(ids).ExecuteCommand() > 0; - } - [Obsolete("Use AsSugarClient()")] - public ISqlSugarClient FullClient { get { return this.Context; } } - } }