mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 01:58:13 +08:00
-
This commit is contained in:
@@ -74,10 +74,25 @@ namespace OrmTest.UnitTest
|
||||
Replace();
|
||||
Length();
|
||||
Time();
|
||||
|
||||
Test1();
|
||||
}
|
||||
base.End("Method Test");
|
||||
}
|
||||
|
||||
private void Test1()
|
||||
{
|
||||
var ids = new int[] { 1, 2, 3 };
|
||||
Expression<Func<Student, bool>> exp = it => ids.Contains(it.Id)&&!SqlFunc.IsNullOrEmpty(it.Name);
|
||||
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
|
||||
expContext.Resolve(exp, ResolveExpressType.WhereSingle);
|
||||
var value = expContext.Result.GetString();
|
||||
var pars = expContext.Parameters;
|
||||
base.Check(value, pars, "(([Id] IN ('1','2','3')) AND NOT( [Name]='' OR [Name] IS NULL ))", new List<SugarParameter>() {
|
||||
|
||||
}, "Test1 error");
|
||||
}
|
||||
|
||||
private void ExtendToString()
|
||||
{
|
||||
Expression<Func<Student, bool>> exp = it => it.Id.ToString() == "a";
|
||||
|
@@ -52,6 +52,12 @@ namespace SqlSugar
|
||||
_Result = value;
|
||||
}
|
||||
}
|
||||
public bool LastCharIsSpace{
|
||||
get {
|
||||
if (_Result == null|| _Result.Length==0) return true;
|
||||
return _Result.ToString().Last() == UtilConstants.SpaceChar;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public string GetString()
|
||||
{
|
||||
|
@@ -239,9 +239,10 @@ namespace SqlSugar
|
||||
protected void AppendNot(object Value)
|
||||
{
|
||||
var isAppend = !this.Context.Result.Contains(ExpressionConst.FormatSymbol);
|
||||
var lastCharIsSpace = this.Context.Result.LastCharIsSpace;
|
||||
if (isAppend)
|
||||
{
|
||||
this.Context.Result.Append("NOT");
|
||||
this.Context.Result.Append(lastCharIsSpace?"NOT":" NOT");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -9,6 +9,7 @@ namespace SqlSugar
|
||||
public const string Dot = ".";
|
||||
public const char DotChar = '.';
|
||||
internal const string Space = " ";
|
||||
internal const char SpaceChar =' ';
|
||||
internal const string AssemblyName = "SqlSugar";
|
||||
internal const string ReplaceKey = "{662E689B-17A1-4D06-9D27-F29EAB8BC3D6}";
|
||||
|
||||
|
Reference in New Issue
Block a user