This commit is contained in:
sunkaixuan
2017-07-03 13:04:34 +08:00
parent 34ac87c66a
commit ee34f43eee
4 changed files with 26 additions and 5 deletions

View File

@@ -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();

View File

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

View File

@@ -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);

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