Browse Source

4.1.0.7

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
ee34f43eee
  1. 13
      Src/Asp.Net/SqlServerTest/UnitTest/ExpressionTest/Method.cs
  2. 10
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs
  3. 4
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs
  4. 4
      Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs

13
Src/Asp.Net/SqlServerTest/UnitTest/ExpressionTest/Method.cs

@ -46,6 +46,7 @@ namespace OrmTest.UnitTest
Trim();
Contains();
Contains2();
Contains3();
ContainsArray();
StartsWith();
EndsWith();
@ -428,6 +429,18 @@ namespace OrmTest.UnitTest
new SugarParameter("@MethodConst0","a")
}, "Contains2 error");
}
private void Contains3(string name = "a")
{
Expression<Func<Student, bool>> exp = it => !SqlFunc.Contains(it.Name, name)&&it.Id==1;
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
var value = expContext.Result.GetString();
var pars = expContext.Parameters;
base.Check(value, pars, "(NOT ([Name] like '%'+@MethodConst0+'%') AND( [Id] = @Id1 ))", new List<SugarParameter>() {
new SugarParameter("@MethodConst0","a"),
new SugarParameter("@Id1",1)
}, "Contains3 error");
}
private void ExtendContainsArray() {
var array = new string[] { "1", "2" }.ToList();

10
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs

@ -304,7 +304,15 @@ namespace SqlSugar
protected void AppendNot(object Value)
{
this.Context.Result.Append("NOT");
var isAppend = !this.Context.Result.Contains(ExpressionConst.Format0);
if (isAppend)
{
this.Context.Result.Append("NOT");
}
else
{
this.Context.Result.Replace(ExpressionConst.Format0, "NOT");
}
}
}
}

4
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs

@ -34,8 +34,8 @@ namespace SqlSugar
var lsrb = !leftIsBinary && rightBinary;
var lbrb = rightBinary && leftIsBinary;
var lsbs = !leftIsBinary && !rightBinary;
var isBegin = !base.Context.Result.Contains(ExpressionConst.Format0);
if (isBegin)
var isAppend = !base.Context.Result.Contains(ExpressionConst.Format0);
if (isAppend)
{
base.Context.Result.Append(ExpressionConst.Format3);
base.Context.Result.Append(ExpressionConst.Format0);

4
Src/Asp.Net/SqlSugar/Properties/AssemblyInfo.cs

@ -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.6")]
[assembly: AssemblyFileVersion("4.1.0.6")]
[assembly: AssemblyVersion("4.1.0.7")]
[assembly: AssemblyFileVersion("4.1.0.7")]

Loading…
Cancel
Save