mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
-
This commit is contained in:
parent
7a03e52621
commit
1aa10dc302
12
OrmTest/Models/ViewModelStudent.cs
Normal file
12
OrmTest/Models/ViewModelStudent.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest.Models
|
||||
{
|
||||
public class ViewModelStudent:Student
|
||||
{
|
||||
}
|
||||
}
|
@ -44,6 +44,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Models\ViewModelStudent.cs" />
|
||||
<Compile Include="UnitTest\ExpressionTest\ExpTestBase.cs" />
|
||||
<Compile Include="UnitTest\ExpressionTest\Field.cs" />
|
||||
<Compile Include="UnitTest\Query\JoinQuery.cs" />
|
||||
|
@ -16,13 +16,13 @@ namespace OrmTest
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//Unit Test
|
||||
int eachCount = 1;
|
||||
new Field(eachCount).Init();
|
||||
new Where(eachCount).Init();
|
||||
new Method(eachCount).Init();
|
||||
new JoinQuery(eachCount).Init();
|
||||
new SingleQuery(eachCount).Init();
|
||||
new SingleQuery(eachCount).Init();
|
||||
int eachCount = 1000;
|
||||
//new Field(eachCount).Init();
|
||||
//new Where(eachCount).Init();
|
||||
//new Method(eachCount).Init();
|
||||
//new JoinQuery(eachCount).Init();
|
||||
//new SingleQuery(eachCount).Init();
|
||||
new SelectQuery(eachCount).Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,12 @@ namespace OrmTest.UnitTest
|
||||
{
|
||||
using (var db = GetInstance())
|
||||
{
|
||||
var list = db.Queryable<Student>().Where(st => st.Id > 0).ToList();
|
||||
var list = db.Queryable<Student>()
|
||||
.Where(st => st.Id > 0)
|
||||
.Select(it => new ViewModelStudent { Name = it.Name }).ToList();
|
||||
var list2 = db.Queryable<Student>()
|
||||
.Where(st => st.Id > 0)
|
||||
.Select("*").ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,11 @@ namespace SqlSugar
|
||||
this.IsClearParameters = true;
|
||||
this.CommandTimeOut = 30000;
|
||||
}
|
||||
public virtual string SqlParameterKeyWord {
|
||||
get {
|
||||
return "@";
|
||||
}
|
||||
}
|
||||
public IDbTransaction Transaction { get; set; }
|
||||
public virtual SqlSugarClient Context { get; set; }
|
||||
public virtual IConnectionConfig MasterConnectionConfig { get; set; }
|
||||
@ -152,7 +157,7 @@ namespace SqlSugar
|
||||
public virtual SugarParameter[] GetParameters(object obj, PropertyInfo[] propertyInfo = null)
|
||||
{
|
||||
if (obj == null) return null;
|
||||
return base.GetParameters(obj, propertyInfo,this.Context.SqlBuilder.SqlParameterKeyWord);
|
||||
return base.GetParameters(obj, propertyInfo,this.SqlParameterKeyWord);
|
||||
}
|
||||
|
||||
public virtual void BeginTran()
|
||||
|
@ -32,20 +32,32 @@ namespace SqlSugar
|
||||
_Pars = new List<SugarParameter>();
|
||||
_Pars.AddRange(pars);
|
||||
}
|
||||
protected void Where<T>(Expression<Func<T, bool>> expression, ResolveExpressType type, SqlSugarClient context) where T : class, new()
|
||||
protected void Where<T>(Expression<Func<T, bool>> expression, ResolveExpressType type,SqlSugarClient context,ISqlBuilder builder) where T : class, new()
|
||||
{
|
||||
ILambdaExpressions resolveExpress = InstanceFactory.GetLambdaExpressions(context.CurrentConnectionConfig);
|
||||
ILambdaExpressions resolveExpress = context.LambdaExpressions;
|
||||
resolveExpress.Resolve(expression, type);
|
||||
Pars.AddRange(resolveExpress.Parameters);
|
||||
context.SqlBuilder.LambadaQueryBuilder.WhereInfos.Add(resolveExpress.Result.GetResultString());
|
||||
builder.LambadaQueryBuilder.WhereInfos.Add(resolveExpress.Result.GetResultString());
|
||||
resolveExpress.Clear();
|
||||
}
|
||||
|
||||
protected void Where<T>(string whereString, object whereObj, SqlSugarClient context) where T : class, new()
|
||||
protected void Where<T>(string whereString, object whereObj, SqlSugarClient context, ISqlBuilder builder) where T : class, new()
|
||||
{
|
||||
var SqlBuilder = context.SqlBuilder;
|
||||
var SqlBuilder = builder;
|
||||
var whereValue = SqlBuilder.LambadaQueryBuilder.WhereInfos;
|
||||
whereValue.Add(SqlBuilder.AppendWhereOrAnd(whereValue.Count == 0, whereString));
|
||||
this.AddPars(whereObj, context);
|
||||
}
|
||||
|
||||
protected void SetSelectType(SqlSugarClient context,ISqlBuilder builder)
|
||||
{
|
||||
var type = ResolveExpressType.SelectSingle;
|
||||
if (builder.LambadaQueryBuilder.JoinQueryInfos.IsValuable())
|
||||
{
|
||||
type = ResolveExpressType.SelectMultiple;
|
||||
}
|
||||
builder.LambadaQueryBuilder.ResolveType = type;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,13 @@ namespace SqlSugar
|
||||
public SqlSugarClient Context { get; set; }
|
||||
public IDb Db { get { return Context.Database; } }
|
||||
public IDbBind Bind { get { return this.Db.DbBind; } }
|
||||
public ISqlBuilder SqlBuilder { get { return this.Context.SqlBuilder; } }
|
||||
public ISqlBuilder SqlBuilder { get; set; }
|
||||
public List<SugarParameter> Pars
|
||||
{
|
||||
get { return PubMethod.IsNullReturnNew<List<SugarParameter>>(base._Pars); }
|
||||
set { base._Pars = value; }
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
Pars = null;
|
||||
@ -29,23 +30,23 @@ namespace SqlSugar
|
||||
public virtual ISugarQueryable<T> Where(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
var type = ResolveExpressType.WhereSingle;
|
||||
if (Context.SqlBuilder.LambadaQueryBuilder.JoinQueryInfos.IsValuable())
|
||||
if (this.SqlBuilder.LambadaQueryBuilder.JoinQueryInfos.IsValuable())
|
||||
{
|
||||
type = ResolveExpressType.WhereMultiple;
|
||||
}
|
||||
base.Where<T>(expression,type, this.Context);
|
||||
base.Where<T>(expression, type, this.Context,this.SqlBuilder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ISugarQueryable<T> Where(string whereString, object whereObj = null)
|
||||
{
|
||||
base.Where<T>(whereString, whereObj, this.Context);
|
||||
base.Where<T>(whereString, whereObj, this.Context,this.SqlBuilder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ISugarQueryable<T> Where<T2>(string whereString, object whereObj = null) where T2 : class, new()
|
||||
{
|
||||
base.Where<T2>(whereString, whereObj, this.Context);
|
||||
base.Where<T2>(whereString, whereObj, this.Context,this.SqlBuilder);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -208,6 +209,9 @@ namespace SqlSugar
|
||||
{
|
||||
var reval = InstanceFactory.GetQueryable<TResult>(this.Context.CurrentConnectionConfig);
|
||||
reval.Context = this.Context;
|
||||
reval.SqlBuilder = this.SqlBuilder;
|
||||
base.SetSelectType(reval.Context,this.SqlBuilder);
|
||||
SqlBuilder.LambadaQueryBuilder.SelectValue = expression;
|
||||
reval.Pars = this.Pars;
|
||||
return reval;
|
||||
}
|
||||
@ -216,14 +220,17 @@ namespace SqlSugar
|
||||
{
|
||||
var reval = InstanceFactory.GetQueryable<TResult>(this.Context.CurrentConnectionConfig);
|
||||
reval.Context = this.Context;
|
||||
reval.Context.SqlBuilder.LambadaQueryBuilder.SelectValue = selectValue;
|
||||
reval.SqlBuilder = this.SqlBuilder;
|
||||
base.SetSelectType(reval.Context,this.SqlBuilder);
|
||||
SqlBuilder.LambadaQueryBuilder.SelectValue = selectValue;
|
||||
reval.Pars = this.Pars;
|
||||
return reval;
|
||||
}
|
||||
|
||||
public ISugarQueryable<T> Select(string select)
|
||||
public ISugarQueryable<T> Select(string selectValue)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
base.SetSelectType(this.Context,this.SqlBuilder);
|
||||
SqlBuilder.LambadaQueryBuilder.SelectValue = selectValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int Count()
|
||||
@ -256,8 +263,7 @@ namespace SqlSugar
|
||||
string sql = SqlBuilder.LambadaQueryBuilder.ToSqlString();
|
||||
using (var dataReader = this.Db.GetDataReader(sql, this.Pars.ToArray()))
|
||||
{
|
||||
var reval = this.Bind.DataReaderToList<T>(typeof(T), dataReader, SqlBuilder.LambadaQueryBuilder.SelectValue);
|
||||
this.Clear();
|
||||
var reval = this.Bind.DataReaderToList<T>(typeof(T), dataReader, SqlBuilder.LambadaQueryBuilder.SelectCacheKey);
|
||||
return reval;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace SqlSugar
|
||||
{
|
||||
public class DeleteBuilder : IDMLBuilder
|
||||
{
|
||||
public SqlSugarClient Conext
|
||||
public SqlSugarClient Context
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ namespace SqlSugar
|
||||
{
|
||||
public class InsertBuilder : IDMLBuilder
|
||||
{
|
||||
public SqlSugarClient Conext
|
||||
public SqlSugarClient Context
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
namespace SqlSugar
|
||||
{
|
||||
@ -11,18 +12,21 @@ namespace SqlSugar
|
||||
{
|
||||
|
||||
}
|
||||
private List<SqlParameter> _QueryPars;
|
||||
|
||||
private List<SugarParameter> _QueryPars;
|
||||
private List<JoinQueryInfo> _JoinQueryInfos;
|
||||
private List<string> _WhereInfos;
|
||||
private string _TableNameString;
|
||||
|
||||
public StringBuilder Sql { get; set; }
|
||||
public SqlSugarClient Conext { get; set; }
|
||||
public SqlSugarClient Context { get; set; }
|
||||
|
||||
public ISqlBuilder Builder { get; set; }
|
||||
public int? Skip { get; set; }
|
||||
public int? Take { get; set; }
|
||||
public string OrderByValue { get; set; }
|
||||
public string SelectValue { get; set; }
|
||||
public object SelectValue { get; set; }
|
||||
public string SelectCacheKey { get; set; }
|
||||
public Type EntityType { get; set; }
|
||||
public string EntityName { get { return this.EntityType.Name; } }
|
||||
public string TableWithString { get; set; }
|
||||
@ -49,24 +53,61 @@ namespace SqlSugar
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Conext.SqlBuilder.GetTranslationTableName(EntityType.Name);
|
||||
return Builder.GetTranslationTableName(EntityType.Name);
|
||||
}
|
||||
}
|
||||
public virtual string GetSelectValueString
|
||||
public virtual string GetSelectValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.SelectValue.IsNullOrEmpty())
|
||||
string reval = string.Empty;
|
||||
if (this.SelectValue==null||this.SelectValue is string)
|
||||
{
|
||||
string pre = null;
|
||||
if (this.JoinQueryInfos.IsValuable() && this.JoinQueryInfos.Any(it => it.PreShortName.IsValuable())) {
|
||||
pre = this.Conext.SqlBuilder.GetTranslationColumnName(this.JoinQueryInfos.Single(it => it.PreShortName.IsValuable()).PreShortName)+".";
|
||||
}
|
||||
return string.Join(",", this.Conext.Database.DbMaintenance.GetColumnInfosByTableName(this.EntityName).Select(it => pre+this.Conext.SqlBuilder.GetTranslationColumnName(it.ColumnName)));
|
||||
reval = GetSelectValueByString();
|
||||
}
|
||||
else return this.SelectValue;
|
||||
else
|
||||
{
|
||||
reval = GetSelectValueByExpression();
|
||||
}
|
||||
if (ResolveType == ResolveExpressType.SelectMultiple) {
|
||||
this.SelectCacheKey = this.SelectCacheKey+string.Join("-",this._JoinQueryInfos.Select(it => it.TableName));
|
||||
}
|
||||
return reval;
|
||||
}
|
||||
}
|
||||
public virtual string GetSelectValueByExpression()
|
||||
{
|
||||
var expression = this.SelectValue as Expression;
|
||||
ILambdaExpressions resolveExpress = this.Context.LambdaExpressions;
|
||||
var isSingle= Builder.LambadaQueryBuilder.JoinQueryInfos.IsValuable();
|
||||
resolveExpress.Resolve(expression, ResolveType);
|
||||
this.QueryPars.AddRange(resolveExpress.Parameters);
|
||||
var reval= resolveExpress.Result.GetResultString();
|
||||
this.SelectCacheKey = reval;
|
||||
resolveExpress.Clear();
|
||||
return reval;
|
||||
}
|
||||
public virtual string GetSelectValueByString()
|
||||
{
|
||||
string reval;
|
||||
if (this.SelectValue.IsNullOrEmpty())
|
||||
{
|
||||
string pre = null;
|
||||
if (this.JoinQueryInfos.IsValuable() && this.JoinQueryInfos.Any(it => it.PreShortName.IsValuable()))
|
||||
{
|
||||
pre = Builder.GetTranslationColumnName(this.JoinQueryInfos.Single(it => it.PreShortName.IsValuable()).PreShortName) + ".";
|
||||
}
|
||||
reval = string.Join(",", this.Context.Database.DbMaintenance.GetColumnInfosByTableName(this.EntityName).Select(it => pre + Builder.GetTranslationColumnName(it.ColumnName)));
|
||||
this.SelectCacheKey = "*";
|
||||
}
|
||||
else
|
||||
{
|
||||
reval = this.SelectValue.ObjToString();
|
||||
}
|
||||
|
||||
return reval;
|
||||
}
|
||||
|
||||
public virtual string GetWhereValueString
|
||||
{
|
||||
get
|
||||
@ -74,7 +115,7 @@ namespace SqlSugar
|
||||
if (this.WhereInfos == null) return null;
|
||||
else
|
||||
{
|
||||
return " WHERE "+string.Join(" ", this.WhereInfos);
|
||||
return " WHERE " + string.Join(" ", this.WhereInfos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,7 +124,8 @@ namespace SqlSugar
|
||||
get
|
||||
{
|
||||
if (this.JoinQueryInfos.IsNullOrEmpty()) return null;
|
||||
else {
|
||||
else
|
||||
{
|
||||
return string.Join(" ", this.JoinQueryInfos.Select(it => this.ToJoinString(it)));
|
||||
}
|
||||
}
|
||||
@ -93,17 +135,18 @@ namespace SqlSugar
|
||||
{
|
||||
Sql = new StringBuilder();
|
||||
var tableString = GetTableNameString;
|
||||
if (this.JoinQueryInfos.IsValuable()) {
|
||||
if (this.JoinQueryInfos.IsValuable())
|
||||
{
|
||||
tableString = tableString + " " + GetJoinValueString;
|
||||
}
|
||||
Sql.AppendFormat(SqlTemplate, GetSelectValueString, tableString , GetWhereValueString);
|
||||
Sql.AppendFormat(SqlTemplate, GetSelectValue, tableString, GetWhereValueString);
|
||||
return Sql.ToString();
|
||||
}
|
||||
public virtual string ToJoinString(JoinQueryInfo joinInfo)
|
||||
{
|
||||
return string.Format(
|
||||
this.JoinTemplate,
|
||||
joinInfo.JoinIndex == 1 ? (joinInfo.PreShortName + " " + joinInfo.JoinType.ToString()+" ") : (joinInfo.JoinType.ToString() + " JOIN "),
|
||||
joinInfo.JoinIndex == 1 ? (joinInfo.PreShortName + " " + joinInfo.JoinType.ToString() + " ") : (joinInfo.JoinType.ToString() + " JOIN "),
|
||||
joinInfo.TableName,
|
||||
joinInfo.ShortName + " " + TableWithString,
|
||||
joinInfo.JoinWhere);
|
||||
@ -117,8 +160,8 @@ namespace SqlSugar
|
||||
}
|
||||
set { _WhereInfos = value; }
|
||||
}
|
||||
|
||||
public virtual List<SqlParameter> QueryPars
|
||||
|
||||
public virtual List<SugarParameter> QueryPars
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
public SqlSugarClient Conext { get; set; }
|
||||
public SqlSugarClient Context { get; set; }
|
||||
|
||||
public string SqlTemplate
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
public SqlSugarClient Conext
|
||||
public SqlSugarClient Context
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ namespace SqlSugar
|
||||
{
|
||||
public class UpdateBuilder : IDMLBuilder
|
||||
{
|
||||
public SqlSugarClient Conext
|
||||
public SqlSugarClient Context
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -67,6 +67,9 @@ namespace SqlSugar
|
||||
public string GetResultString()
|
||||
{
|
||||
if (this._Result == null) return null;
|
||||
if (this._ResolveExpressType.IsIn(ResolveExpressType.SelectMultiple, ResolveExpressType.SelectSingle)) {
|
||||
return this.Result.ToString().TrimEnd(',');
|
||||
}
|
||||
return this.Result.ToString();
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,10 @@ namespace SqlSugar
|
||||
{
|
||||
return string.Format(" {0} {1} {2} ", fieldValue, "AS", fieldName);
|
||||
}
|
||||
public virtual void Clear()
|
||||
{
|
||||
base._Result = null;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace SqlSugar
|
||||
{
|
||||
public partial interface IDb
|
||||
{
|
||||
string SqlParameterKeyWord { get; }
|
||||
IDbConnection Connection { get; set; }
|
||||
IDbTransaction Transaction { get; set; }
|
||||
IDataParameter[] ToIDbDataParameter(params SugarParameter[] pars);
|
||||
|
@ -19,5 +19,6 @@ namespace SqlSugar
|
||||
string GetaMppingColumnsName(string name);
|
||||
string GetAsString(string fieldName, string fieldValue);
|
||||
void Resolve(Expression expression, ResolveExpressType resolveType);
|
||||
void Clear();
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace SqlSugar
|
||||
public partial interface ISugarQueryable<T> where T : class, new()
|
||||
{
|
||||
SqlSugarClient Context { get; set; }
|
||||
ISqlBuilder SqlBuilder { get; set; }
|
||||
List<SugarParameter> Pars { get; set; }
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace SqlSugar
|
||||
public partial interface IDMLBuilder
|
||||
{
|
||||
string SqlTemplate { get; }
|
||||
SqlSugarClient Conext { get; set; }
|
||||
SqlSugarClient Context { get; set; }
|
||||
StringBuilder Sql { get; set; }
|
||||
string ToSqlString();
|
||||
void Clear();
|
||||
|
@ -19,7 +19,6 @@ namespace SqlSugar
|
||||
protected ISqlBuilder _SqlBuilder;
|
||||
protected IDb _Ado;
|
||||
protected ILambdaExpressions _LambdaExpressions;
|
||||
protected object _Queryable;
|
||||
protected object _Sqlable;
|
||||
|
||||
protected void InitConstructor()
|
||||
|
@ -72,23 +72,6 @@ namespace SqlSugar
|
||||
|
||||
#region properties
|
||||
/// <summary>
|
||||
/// Sql string processing
|
||||
/// </summary>
|
||||
public virtual ISqlBuilder SqlBuilder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_SqlBuilder == null)
|
||||
{
|
||||
var reval = InstanceFactory.GetSqlbuilder(base.CurrentConnectionConfig);
|
||||
_SqlBuilder = reval;
|
||||
_SqlBuilder.Context = this;
|
||||
return reval;
|
||||
}
|
||||
return _SqlBuilder;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///Database operation
|
||||
/// </summary>
|
||||
public virtual IDb Database
|
||||
@ -128,54 +111,51 @@ namespace SqlSugar
|
||||
/// </summary>
|
||||
public virtual ISugarQueryable<T> Queryable<T>() where T : class, new()
|
||||
{
|
||||
if (_Queryable == null)
|
||||
{
|
||||
var reval = InstanceFactory.GetQueryable<T>(base.CurrentConnectionConfig);
|
||||
reval.Context = this;
|
||||
var sqlBuilder = reval.Context.SqlBuilder;
|
||||
sqlBuilder.LambadaQueryBuilder = InstanceFactory.GetLambadaQueryBuilder(base.CurrentConnectionConfig);
|
||||
sqlBuilder.LambadaQueryBuilder.Conext = this;
|
||||
sqlBuilder.LambadaQueryBuilder.EntityType = typeof(T);
|
||||
_Queryable = reval;
|
||||
return reval;
|
||||
}
|
||||
return (ISugarQueryable<T>)_Queryable;
|
||||
var reval = InstanceFactory.GetQueryable<T>(base.CurrentConnectionConfig);
|
||||
reval.Context = this;
|
||||
var SqlBuilder = InstanceFactory.GetSqlbuilder(base.CurrentConnectionConfig); ;
|
||||
reval.SqlBuilder = SqlBuilder;
|
||||
reval.SqlBuilder.LambadaQueryBuilder = InstanceFactory.GetLambadaQueryBuilder(base.CurrentConnectionConfig);
|
||||
reval.SqlBuilder.LambadaQueryBuilder.Builder = SqlBuilder;
|
||||
reval.SqlBuilder.Context = reval.SqlBuilder.LambadaQueryBuilder.Context = this;
|
||||
reval.SqlBuilder.LambadaQueryBuilder.EntityType = typeof(T);
|
||||
return reval;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2>(Expression<Func<T,T2,object []>> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2>(Expression<Func<T, T2, object[]>> joinExpression) where T : class, new()
|
||||
{
|
||||
var queryable = Queryable<T>();
|
||||
SqlBuilder.LambadaQueryBuilder.JoinQueryInfos = base.GetJoinInfos(joinExpression,this,typeof(T2));
|
||||
queryable.SqlBuilder.LambadaQueryBuilder.JoinQueryInfos = base.GetJoinInfos(joinExpression, this, typeof(T2));
|
||||
return queryable;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3>(Func<T, T2,T3, object[]> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3>(Func<T, T2, T3, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual List<T> Queryable<T, T2, T3, T4>(Func<T, T2, T3,T4, object[]> joinExpression) where T : class, new()
|
||||
public virtual List<T> Queryable<T, T2, T3, T4>(Func<T, T2, T3, T4, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5>(Func<T, T2, T3, T4,T5, object[]> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5>(Func<T, T2, T3, T4, T5, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6>(Func<T, T2, T3, T4, T5,T6, object[]> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6>(Func<T, T2, T3, T4, T5, T6, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7>(Func<T, T2, T3, T4, T5, T6,T7, object[]> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7>(Func<T, T2, T3, T4, T5, T6, T7, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Func<T, T2, T3, T4, T5, T6,T7,T8, object[]> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7, T8>(Func<T, T2, T3, T4, T5, T6, T7, T8, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T, T2, T3, T4, T5, T6, T7, T8,T9, object[]> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9>(Func<T, T2, T3, T4, T5, T6, T7, T8, T9, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Func<T, T2, T3, T4, T5, T6, T7, T8,T10, object[]> joinExpression) where T : class, new()
|
||||
public virtual ISugarQueryable<T> Queryable<T, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Func<T, T2, T3, T4, T5, T6, T7, T8, T10, object[]> joinExpression) where T : class, new()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -202,11 +182,12 @@ namespace SqlSugar
|
||||
public virtual List<T> SqlQuery<T>(string sql, object pars = null)
|
||||
{
|
||||
var dbPars = this.Database.GetParameters(pars);
|
||||
this.SqlBuilder.SqlQueryBuilder.Sql.Append(sql);
|
||||
var builder = InstanceFactory.GetSqlbuilder(base.CurrentConnectionConfig);
|
||||
builder.SqlQueryBuilder.Sql.Append(sql);
|
||||
using (var dataReader = this.Database.GetDataReader(sql, dbPars))
|
||||
{
|
||||
var reval = this.Database.DbBind.DataReaderToList<T>(typeof(T), dataReader, this.SqlBuilder.SqlQueryBuilder.Fields);
|
||||
this.SqlBuilder.SqlQueryBuilder.Clear();
|
||||
var reval = this.Database.DbBind.DataReaderToList<T>(typeof(T), dataReader, builder.SqlQueryBuilder.Fields);
|
||||
builder.SqlQueryBuilder.Clear();
|
||||
return reval;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user