Code optimization

This commit is contained in:
sunkaixuan 2022-10-22 18:30:57 +08:00
parent 6e9593bb52
commit eca729e877
3 changed files with 51 additions and 36 deletions

View File

@ -0,0 +1,49 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
using System.Reflection;
using System.Dynamic;
using System.Threading.Tasks;
namespace SqlSugar
{
public partial class QueryableProvider<T> : QueryableAccessory, ISugarQueryable<T>
{
public SqlSugarProvider Context { get; set; }
public IAdo Db { get { return Context.Ado; } }
public IDbBind Bind { get { return this.Db.DbBind; } }
public ISqlBuilder SqlBuilder { get; set; }
public MappingTableList OldMappingTableList { get; set; }
public MappingTableList QueryableMappingTableList { get; set; }
public List<Action<T>> MapperAction { get; set; }
public Action<T, MapperCache<T>> MapperActionWithCache { get; set; }
public List<Action<List<T>>> Mappers { get; set; }
public bool IsCache { get; set; }
public int CacheTime { get; set; }
public string CacheKey { get; set; }
public bool IsAs { get; set; }
public QueryBuilder QueryBuilder
{
get
{
return this.SqlBuilder.QueryBuilder;
}
set
{
this.SqlBuilder.QueryBuilder = value;
}
}
public EntityInfo EntityInfo
{
get
{
return this.Context.EntityMaintenance.GetEntityInfo<T>();
}
}
}
}

View File

@ -15,42 +15,7 @@ namespace SqlSugar
#region T1
public partial class QueryableProvider<T> : QueryableAccessory, ISugarQueryable<T>
{
public SqlSugarProvider Context { get; set; }
public IAdo Db { get { return Context.Ado; } }
public IDbBind Bind { get { return this.Db.DbBind; } }
public ISqlBuilder SqlBuilder { get; set; }
public MappingTableList OldMappingTableList { get; set; }
public MappingTableList QueryableMappingTableList { get; set; }
public List<Action<T>> MapperAction { get; set; }
public Action<T, MapperCache<T>> MapperActionWithCache { get; set; }
public List<Action<List<T>>> Mappers { get; set; }
public bool IsCache { get; set; }
public int CacheTime { get; set; }
public string CacheKey { get; set; }
public bool IsAs { get; set; }
public QueryBuilder QueryBuilder
{
get
{
return this.SqlBuilder.QueryBuilder;
}
set
{
this.SqlBuilder.QueryBuilder = value;
}
}
public EntityInfo EntityInfo
{
get
{
return this.Context.EntityMaintenance.GetEntityInfo<T>();
}
}
//public ISugarQueryable<T> CrossQueryWithAttr()
//{
// this.QueryBuilder.IsCrossQueryWithAttr = true;
// return this;
//}
public ISugarQueryable<T> CrossQuery<Type>(string configId)
{
return this.CrossQuery(typeof(Type),configId);

View File

@ -114,6 +114,7 @@
<Compile Include="Abstract\FastestProvider\SplitFastest.cs" />
<Compile Include="Abstract\FilterProvider\FilterProvider.cs" />
<Compile Include="Abstract\InsertableProvider\InsertableHelper.cs" />
<Compile Include="Abstract\QueryableProvider\QueryableProperties.cs" />
<Compile Include="Abstract\QueryableProvider\QueryableProvider11-12.cs" />
<Compile Include="Abstract\QueryableProvider\QueryableProvider06-10.cs" />
<Compile Include="Abstract\QueryableProvider\QueryableHelper.cs" />