mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 10:45:08 +08:00
-
This commit is contained in:
Binary file not shown.
22
OrmTest/ExpressionTest/Select.cs
Normal file
22
OrmTest/ExpressionTest/Select.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using OrmTest.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest.ExpressionTest
|
||||
{
|
||||
public class Select
|
||||
{
|
||||
internal static void Init()
|
||||
{
|
||||
Expression<Func<Student, object>> exp = it => new Program() { x = it.Name };
|
||||
ExpressionContext expContext = new ExpressionContext(exp, ResolveExpressType.WhereSingle);
|
||||
expContext.ResolveType = ResolveExpressType.SelectSingle;
|
||||
var x= expContext.ToResultString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -43,6 +43,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ExpressionTest\Select.cs" />
|
||||
<Compile Include="Models\School.cs" />
|
||||
<Compile Include="Models\Student.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
|
@@ -21,6 +21,11 @@ namespace OrmTest
|
||||
public static string id { get; set;}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
|
||||
OrmTest.ExpressionTest.Select.Init();
|
||||
|
||||
|
||||
Program.id = "xx";
|
||||
string x = "1";
|
||||
Expression<Func<Student, object>> exp = it => new Program() { x=it.Name };
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,9 +13,9 @@ namespace SqlSugar
|
||||
private ExpressionContext() {
|
||||
|
||||
}
|
||||
public ExpressionContext(Expression expression, ResolveExpressType type)
|
||||
public ExpressionContext(Expression expression, ResolveExpressType resolveType)
|
||||
{
|
||||
this.Type = type;
|
||||
this.ResolveType = resolveType;
|
||||
this.Expression = expression;
|
||||
}
|
||||
#endregion
|
||||
@@ -23,7 +23,7 @@ namespace SqlSugar
|
||||
#region properties
|
||||
public IDbMethods DbMehtods { get; set; }
|
||||
public int Index { get; set; }
|
||||
public ResolveExpressType Type { get; set; }
|
||||
public ResolveExpressType ResolveType { get; set; }
|
||||
public Expression Expression { get; set; }
|
||||
public StringBuilder ResultString { get; set; }
|
||||
public object ResultObj { get; set; }
|
||||
@@ -31,7 +31,7 @@ namespace SqlSugar
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Type == ResolveExpressType.WhereSingle;
|
||||
return this.ResolveType == ResolveExpressType.WhereSingle;
|
||||
}
|
||||
}
|
||||
public List<SugarParameter> Parameters
|
||||
|
@@ -13,7 +13,7 @@ namespace SqlSugar
|
||||
var isLeft = parameter.IsLeft;
|
||||
var isWhereSingle = parameter.Context.IsWhereSingle;
|
||||
string fieldName = string.Empty;
|
||||
switch (parameter.Context.Type)
|
||||
switch (parameter.Context.ResolveType)
|
||||
{
|
||||
case ResolveExpressType.WhereSingle:
|
||||
fieldName = GetFieldNameByWhereSingle(parameter, expression, isLeft);
|
||||
|
@@ -11,7 +11,7 @@ namespace SqlSugar
|
||||
public MemberInitExpressionResolve(ExpressionParameter parameter) : base(parameter)
|
||||
{
|
||||
var expression = base.Expression as MemberInitExpression;
|
||||
switch (parameter.Context.Type)
|
||||
switch (parameter.Context.ResolveType)
|
||||
{
|
||||
case ResolveExpressType.WhereSingle:
|
||||
break;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user