Browse Source

-

pull/12/MERGE
610262374@qq.com 8 years ago
parent
commit
75798ab973
  1. 9
      OrmTest/UnitTest/Query/SelectQuery.cs
  2. 2
      SqlSugar/Abstract/QueryableProvider/QueryableAccessory.cs
  3. 2
      SqlSugar/Abstract/SqlBuilderProvider/DMLBuilder/LambadaQueryBuilder.cs
  4. 3
      SqlSugar/DetaultT.cs
  5. 4
      SqlSugar/SqlSugarClient.cs

9
OrmTest/UnitTest/Query/SelectQuery.cs

@ -40,10 +40,11 @@ namespace OrmTest.UnitTest
JoinType.Left,st.SchoolId==sc.Id
}).Where(st => st.Id > 0).Select<Student>("*").ToList();
//var list3 = db.Queryable("Student","st")
// .AddJoinInfo("Shool","sh", "sh.id=st.shoolid")
// .Where(st => st.Id > 0)
// .Select(st => new ViewModelStudent2 { Student = st }).ToList();
var list3 = db.Queryable("Student", "st")
.AddJoinInfo("School", "sh", "sh.id=st.schoolid")
.Where("st.id>@id")
.AddParameters(new {id=1})
.Select("st.*").ToList();
}
}

2
SqlSugar/Abstract/QueryableProvider/QueryableAccessory.cs

@ -37,7 +37,7 @@ namespace SqlSugar
ILambdaExpressions resolveExpress = context.LambdaExpressions;
resolveExpress.Resolve(expression, type);
Pars.AddRange(resolveExpress.Parameters);
builder.LambadaQueryBuilder.WhereInfos.Add(resolveExpress.Result.GetResultString());
builder.LambadaQueryBuilder.WhereInfos.Add(builder.AppendWhereOrAnd(builder.LambadaQueryBuilder.WhereInfos.IsNullOrEmpty(),resolveExpress.Result.GetResultString()));
resolveExpress.Clear();
}

2
SqlSugar/Abstract/SqlBuilderProvider/DMLBuilder/LambadaQueryBuilder.cs

@ -122,7 +122,7 @@ namespace SqlSugar
if (this.WhereInfos == null) return null;
else
{
return " WHERE " + string.Join(" ", this.WhereInfos);
return string.Join(" ", this.WhereInfos);
}
}
}

3
SqlSugar/DetaultT.cs

@ -1,6 +1,7 @@
namespace SqlSugar
{
public class DetaultT
public class SugarDynamic
{
}
}

4
SqlSugar/SqlSugarClient.cs

@ -126,9 +126,9 @@ namespace SqlSugar
/// <summary>
/// Lambda Query operation
/// </summary>
public virtual ISugarQueryable<DetaultT> Queryable(string tableName,string shortName,string widthString=null)
public virtual ISugarQueryable<SugarDynamic> Queryable(string tableName,string shortName,string widthString=null)
{
var queryable = Queryable<DetaultT>();
var queryable = Queryable<SugarDynamic>();
queryable.SqlBuilder.LambadaQueryBuilder.EntityName = tableName;
queryable.SqlBuilder.LambadaQueryBuilder.TableShortName = shortName;
queryable.SqlBuilder.LambadaQueryBuilder.TableWithString = widthString;

Loading…
Cancel
Save