Delete obsolete

This commit is contained in:
SUNKAIXUAN 2021-04-01 15:50:09 +08:00
parent ca5edf3674
commit baadbeb99d
3 changed files with 11 additions and 138 deletions

View File

@ -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

View File

@ -828,16 +828,16 @@ namespace SqlSugar
#endregion
#region SimpleClient
[Obsolete("Use SqlSugarClient.GetSimpleClient() Or SqlSugarClient.GetSimpleClient<T>() ")]
public virtual SimpleClient SimpleClient
{
get
{
if (this._SimpleClient == null)
this._SimpleClient = new SimpleClient(this);
return this._SimpleClient;
}
}
//[Obsolete("Use SqlSugarClient.GetSimpleClient() Or SqlSugarClient.GetSimpleClient<T>() ")]
//public virtual SimpleClient SimpleClient
//{
// get
// {
// if (this._SimpleClient == null)
// this._SimpleClient = new SimpleClient(this);
// return this._SimpleClient;
// }
//}
public virtual SimpleClient<T> GetSimpleClient<T>() where T : class, new()
{
return new SimpleClient<T>(this);

View File

@ -291,131 +291,4 @@ namespace SqlSugar
[Obsolete("Use AsSugarClient()")]
public ISqlSugarClient FullClient { get { return this.Context; } }
}
[Obsolete("Use SimpleClient<T>")]
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<T>(dynamic id) where T : class, new()
{
return Context.Queryable<T>().InSingle(id);
}
public int Count<T>(Expression<Func<T, bool>> whereExpression)
{
return Context.Queryable<T>().Where(whereExpression).Count();
}
public List<T> GetList<T>() where T : class, new()
{
return Context.Queryable<T>().ToList();
}
public T GetSingle<T>(Expression<Func<T, bool>> whereExpression) where T : class, new()
{
return Context.Queryable<T>().Single(whereExpression);
}
public List<T> GetList<T>(Expression<Func<T, bool>> whereExpression) where T : class, new()
{
return Context.Queryable<T>().Where(whereExpression).ToList();
}
public List<T> GetPageList<T>(Expression<Func<T, bool>> whereExpression, PageModel page) where T : class, new()
{
int count = 0;
var result = Context.Queryable<T>().Where(whereExpression).ToPageList(page.PageIndex, page.PageSize, ref count);
page.PageCount = count;
return result;
}
public List<T> GetPageList<T>(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc) where T : class, new()
{
int count = 0;
var result = Context.Queryable<T>().OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(whereExpression).ToPageList(page.PageIndex, page.PageSize, ref count);
page.PageCount = count;
return result;
}
public List<T> GetPageList<T>(List<IConditionalModel> conditionalList, PageModel page) where T : class, new()
{
int count = 0;
var result = Context.Queryable<T>().Where(conditionalList).ToPageList(page.PageIndex, page.PageSize, ref count);
page.PageCount = count;
return result;
}
public List<T> GetPageList<T>(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc) where T : class, new()
{
int count = 0;
var result = Context.Queryable<T>().OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(conditionalList).ToPageList(page.PageIndex, page.PageSize, ref count);
page.PageCount = count;
return result;
}
public bool IsAny<T>(Expression<Func<T, bool>> whereExpression) where T : class, new()
{
return Context.Queryable<T>().Where(whereExpression).Any();
}
public bool Insert<T>(T insertObj) where T : class, new()
{
return this.Context.Insertable(insertObj).ExecuteCommand() > 0;
}
public int InsertReturnIdentity<T>(T insertObj) where T : class, new()
{
return this.Context.Insertable(insertObj).ExecuteReturnIdentity();
}
public bool InsertRange<T>(T[] insertObjs) where T : class, new()
{
return this.Context.Insertable(insertObjs).ExecuteCommand() > 0;
}
public bool InsertRange<T>(List<T> insertObjs) where T : class, new()
{
return this.Context.Insertable(insertObjs).ExecuteCommand() > 0;
}
public bool Update<T>(T updateObj) where T : class, new()
{
return this.Context.Updateable(updateObj).ExecuteCommand() > 0;
}
public bool UpdateRange<T>(T[] updateObjs) where T : class, new()
{
return this.Context.Updateable(updateObjs).ExecuteCommand() > 0;
}
public bool UpdateRange<T>(List<T> updateObjs) where T : class, new()
{
return this.Context.Updateable(updateObjs).ExecuteCommand() > 0;
}
public bool Update<T>(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression) where T : class, new()
{
return this.Context.Updateable<T>(columns).Where(whereExpression).ExecuteCommand() > 0;
}
public bool Delete<T>(T deleteObj) where T : class, new()
{
return this.Context.Deleteable<T>().Where(deleteObj).ExecuteCommand() > 0;
}
public bool Delete<T>(Expression<Func<T, bool>> whereExpression) where T : class, new()
{
return this.Context.Deleteable<T>().Where(whereExpression).ExecuteCommand() > 0;
}
public bool DeleteById<T>(dynamic id) where T : class, new()
{
return this.Context.Deleteable<T>().In(id).ExecuteCommand() > 0;
}
public bool DeleteByIds<T>(dynamic[] ids) where T : class, new()
{
return this.Context.Deleteable<T>().In(ids).ExecuteCommand() > 0;
}
[Obsolete("Use AsSugarClient()")]
public ISqlSugarClient FullClient { get { return this.Context; } }
}
}