Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
3ecf1beaea
  1. BIN
      .vs/SqlSugar/v14/.suo
  2. 5
      OrmTest/Program.cs
  3. BIN
      OrmTest/bin/Debug/OrmTest.exe
  4. BIN
      OrmTest/bin/Debug/OrmTest.pdb
  5. BIN
      OrmTest/bin/Debug/SqlSugar.dll
  6. BIN
      OrmTest/bin/Debug/SqlSugar.pdb
  7. BIN
      OrmTest/obj/Debug/OrmTest.csprojResolveAssemblyReference.cache
  8. BIN
      OrmTest/obj/Debug/OrmTest.exe
  9. BIN
      OrmTest/obj/Debug/OrmTest.pdb
  10. 7
      SqlSugar/ExpressionsToSql/ExpressionContext.cs
  11. 1
      SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs
  12. 12
      SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs
  13. 6
      SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs
  14. 2
      SqlSugar/ExpressionsToSql/ResolveItems/LambdaExpressionResolve.cs
  15. 6
      SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs
  16. BIN
      SqlSugar/bin/Debug/SqlSugar.dll
  17. BIN
      SqlSugar/bin/Debug/SqlSugar.pdb
  18. 1
      SqlSugar/obj/Debug/SqlSugar.csproj.FileListAbsolute.txt
  19. BIN
      SqlSugar/obj/Debug/SqlSugar.csprojResolveAssemblyReference.cache
  20. BIN
      SqlSugar/obj/Debug/SqlSugar.dll
  21. BIN
      SqlSugar/obj/Debug/SqlSugar.pdb

BIN
.vs/SqlSugar/v14/.suo

Binary file not shown.

5
OrmTest/Program.cs

@ -16,10 +16,11 @@ namespace OrmTest
{
static void Main(string[] args)
{
Expression<Func<Student, bool>> exp = it => it.Name!="a";
string id = "1";
Expression<Func<Student, bool>> exp = it => it.Name!=id;
ExpressionContext expContext = new ExpressionContext(exp, ResolveExpressType.Single);
// var x = expContext.GetFiledName();
var xx = expContext.ToString();
var xx = expContext.ToSqlString();
var b = DateTime.Now;

BIN
OrmTest/bin/Debug/OrmTest.exe

Binary file not shown.

BIN
OrmTest/bin/Debug/OrmTest.pdb

Binary file not shown.

BIN
OrmTest/bin/Debug/SqlSugar.dll

Binary file not shown.

BIN
OrmTest/bin/Debug/SqlSugar.pdb

Binary file not shown.

BIN
OrmTest/obj/Debug/OrmTest.csprojResolveAssemblyReference.cache

Binary file not shown.

BIN
OrmTest/obj/Debug/OrmTest.exe

Binary file not shown.

BIN
OrmTest/obj/Debug/OrmTest.pdb

Binary file not shown.

7
SqlSugar/ExpressionsToSql/ExpressionContext.cs

@ -11,6 +11,7 @@ namespace SqlSugar
{
public ResolveExpressType Type { get; set; }
public Expression Expression { get; set; }
public StringBuilder SqlWhere { get; set; }
public virtual string SqlParameterKeyWord
{
get
@ -30,12 +31,12 @@ namespace SqlSugar
this.Expression = expression;
}
public override string ToString()
public string ToSqlString()
{
BaseResolve resolve = new BaseResolve(new ExpressionParameter() { Expression = this.Expression, Context = this });
resolve.Start();
if (resolve.SqlWhere == null) return string.Empty;
return resolve.SqlWhere.ToString();
if (this.SqlWhere == null) return string.Empty;
return this.SqlWhere.ToString();
}
public List<SugarParameter> Parameters

1
SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs

@ -10,7 +10,6 @@ namespace SqlSugar
protected Expression Expression { get; set; }
protected Expression BaseExpression { get; set; }
public ExpressionContext Context { get; set; }
public StringBuilder SqlWhere { get; set; }
public bool? IsLeft { get; set; }
public int ContentIndex { get { return this.Context.Index; } }
public int Index { get; set; }

12
SqlSugar/ExpressionsToSql/ResolveItems/BinaryExpressionResolve.cs

@ -28,21 +28,21 @@ namespace SqlSugar
string leftString = GetLeftString(parameter);
string rightString = GetRightString(parameter);
string binarySql =string.Format(ExpressionConst.BinaryFormatString,leftString,operatorValue,rightString);
string sqlWhereString = base.SqlWhere.ObjToString();
if (base.SqlWhere == null) {
base.SqlWhere = new StringBuilder();
string sqlWhereString = base.Context.SqlWhere.ObjToString();
if (base.Context.SqlWhere == null) {
base.Context.SqlWhere = new StringBuilder();
}
if (sqlWhereString.Contains(ExpressionConst.Format0))
{
base.SqlWhere.Replace(ExpressionConst.Format0, sqlWhereString);
base.Context.SqlWhere.Replace(ExpressionConst.Format0, binarySql);
}
else
{
base.SqlWhere.Append(binarySql);
base.Context.SqlWhere.Append(binarySql);
}
if (sqlWhereString.Contains(ExpressionConst.Format1))
{
base.SqlWhere.Replace(ExpressionConst.Format1, ExpressionConst.Format0);
base.Context.SqlWhere.Replace(ExpressionConst.Format1, ExpressionConst.Format0);
}
}

6
SqlSugar/ExpressionsToSql/ResolveItems/ConstantExpressionResolve.cs

@ -23,10 +23,10 @@ namespace SqlSugar
ExpressionType = expression.GetType()
}));
}
if (isLeft == null && base.SqlWhere == null)
if (isLeft == null && base.Context.SqlWhere == null)
{
base.SqlWhere = new StringBuilder();
base.SqlWhere.Append(value);
base.Context.SqlWhere = new StringBuilder();
base.Context.SqlWhere.Append(value);
}
}

2
SqlSugar/ExpressionsToSql/ResolveItems/LambdaExpressionResolve.cs

@ -14,7 +14,7 @@ namespace SqlSugar
if (expression.NodeType == ExpressionType.MemberAccess)
{
string appendString = "(" +((MemberExpression)expression).Member.Name + "=1)";
base.SqlWhere.Append(appendString);
base.Context.SqlWhere.Append(appendString);
}
else
{

6
SqlSugar/ExpressionsToSql/ResolveItems/MemberExpressionResolve.cs

@ -21,10 +21,10 @@ namespace SqlSugar
Value = fieldName,
ExpressionType = expression.GetType()
}));
if (isLeft == null && base.SqlWhere == null)
if (isLeft == null && base.Context.SqlWhere == null)
{
base.SqlWhere = new StringBuilder();
base.SqlWhere.Append(fieldName);
base.Context.SqlWhere = new StringBuilder();
base.Context.SqlWhere.Append(fieldName);
}
}
}

BIN
SqlSugar/bin/Debug/SqlSugar.dll

Binary file not shown.

BIN
SqlSugar/bin/Debug/SqlSugar.pdb

Binary file not shown.

1
SqlSugar/obj/Debug/SqlSugar.csproj.FileListAbsolute.txt

@ -3,4 +3,3 @@ F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\SqlSugar.pdb
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\bin\Debug\Newtonsoft.Json.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.dll
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.pdb
F:\MyOpenSource\SqlSugar4.XNew\SqlSugar\SqlSugar\obj\Debug\SqlSugar.csprojResolveAssemblyReference.cache

BIN
SqlSugar/obj/Debug/SqlSugar.csprojResolveAssemblyReference.cache

Binary file not shown.

BIN
SqlSugar/obj/Debug/SqlSugar.dll

Binary file not shown.

BIN
SqlSugar/obj/Debug/SqlSugar.pdb

Binary file not shown.
Loading…
Cancel
Save