Update Expression Convert Bug

This commit is contained in:
sunkaixuan 2017-06-26 23:02:09 +08:00
parent bd2b3570c0
commit 1672bab14a
5 changed files with 37 additions and 18 deletions

View File

@ -17,22 +17,22 @@ namespace OrmTest
{
static void Main(string[] args)
{
// /***Unit Test***/
// new Field(1).Init();
// new Where(1).Init();
// new Method(1).Init();
// new JoinQuery(1).Init();
// new SingleQuery(1).Init();
// new SelectQuery(1).Init();
// new AutoClose(1).Init();
// new Insert(1).Init();
// /***Unit Test***/
new Field(1).Init();
new Where(1).Init();
new Method(1).Init();
new JoinQuery(1).Init();
new SingleQuery(1).Init();
new SelectQuery(1).Init();
new AutoClose(1).Init();
new Insert(1).Init();
new Delete(1).Init();
// new Update(1).Init();
// new Mapping(1).Init();
// new DataTest(1).Init();
new Update(1).Init();
new Mapping(1).Init();
new DataTest(1).Init();
// /***Performance Test***/
// new SqlSugarPerformance(100).Select();
/***Performance Test***/
new SqlSugarPerformance(100).Select();
/***Demo***/
OrmTest.Demo.Query.Init();

View File

@ -21,6 +21,7 @@ namespace OrmTest.UnitTest
base.Begin();
for (int i = 0; i < base.Count; i++)
{
whereSingle15();
whereSingle1();
whereSingle2();
whereSingle3();
@ -35,6 +36,7 @@ namespace OrmTest.UnitTest
whereSingle12();
whereSingle13();
whereSingle14();
whereSingle15();
WhereMultiple1();
WhereMultiple2();
@ -249,6 +251,19 @@ namespace OrmTest.UnitTest
}, "whereSingle14");
}
private void whereSingle15()
{
Expression<Func<DataTestInfo, bool>> exp = it =>it.Money2 == 1;
ExpressionContext expContext = new ExpressionContext();
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
var value = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(value, pars, "( [Money2] = @Const0 )", new List<SugarParameter>()
{
new SugarParameter("@Const0",1)
}, "whereSingle15");
}
}
public class WhereConst

View File

@ -24,7 +24,11 @@ namespace SqlSugar
base.Expression = expression.Operand;
var isMember = expression.Operand is MemberExpression;
var isConst = expression.Operand is ConstantExpression;
if (base.Expression is BinaryExpression || parameter.BaseExpression is BinaryExpression)
if (baseParameter.CurrentExpression is NewArrayExpression)
{
Result(parameter, nodeType);
}
else if (base.Expression is BinaryExpression || parameter.BaseExpression is BinaryExpression || baseParameter.CommonTempData.ObjToString() == CommonTempDataType.Append.ToString())
{
Append(parameter, nodeType);
}

View File

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.1.0.1")]
[assembly: AssemblyFileVersion("4.1.0.1")]
[assembly: AssemblyVersion("4.1.0.2")]
[assembly: AssemblyFileVersion("4.1.0.2")]

View File

@ -2,7 +2,7 @@
<package >
<metadata>
<id>sqlSugar</id>
<version>4.1.0.1</version>
<version>4.1.0.2</version>
<title>SqlSugar SqlServer ORM</title>
<authors>sun kaixuan</authors>
<owners>landa</owners>