Add SqlFunc.GetSelfAndAutoFill

This commit is contained in:
sunkaixuan
2017-07-17 12:56:21 +08:00
parent cf71763d53
commit c74d460885
8 changed files with 63 additions and 19 deletions

View File

@@ -15,4 +15,8 @@ namespace OrmTest.Models
public string Name { get; set; }
public Student Student { get; set; }
}
public class ViewModelStudent3: Student
{
public string SchoolName { get; set; }
}
}

View File

@@ -27,6 +27,7 @@ namespace OrmTest.UnitTest
single4();
single5();
Multiple();
Multiple2();
singleDynamic();
MultipleDynamic();
}
@@ -51,8 +52,26 @@ namespace OrmTest.UnitTest
},
"Select.Multiple Error");
}
private void Multiple2()
{
Expression<Func<Student, School, object>> exp = (it, school) => new ViewModelStudent3() { SchoolName=school.Name,Id=SqlFunc.GetSelfAndAutoFill(it.Id) };
ExpressionContext expContext = new ExpressionContext();
expContext.IsSingle = false;
expContext.Resolve(exp, ResolveExpressType.SelectMultiple);
var selectorValue = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(
selectorValue,
pars,
@" [school].[Name] AS [SchoolName] ,it.*",
new List<SugarParameter>(){
},
"Select.Multiple Error");
}
private void MultipleDynamic()
private void MultipleDynamic()
{
Expression<Func<Student, School, object>> exp = (it, school) => new { Name = "a", Id = it.Id / 2, SchoolId = school.Id };
ExpressionContext expContext = new ExpressionContext();