mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
统一返回类型
This commit is contained in:
parent
b776582c35
commit
3ad3e1a1d9
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -8,6 +8,7 @@ namespace SqlSugar
|
||||
{
|
||||
public class ExpResolveAccessory
|
||||
{
|
||||
protected List<SugarParameter> _Parameters { get; set; }
|
||||
protected List<SugarParameter> _Parameters;
|
||||
protected ExpressionResult _Result;
|
||||
}
|
||||
}
|
||||
|
87
SqlSugar/ExpressionsToSql/Common/ExpressionResult.cs
Normal file
87
SqlSugar/ExpressionsToSql/Common/ExpressionResult.cs
Normal file
@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class ExpressionResult
|
||||
{
|
||||
#region constructor
|
||||
private ExpressionResult()
|
||||
{
|
||||
}
|
||||
public ExpressionResult(ResolveExpressType resolveExpressType)
|
||||
{
|
||||
this._ResolveExpressType = resolveExpressType;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
private ResolveExpressType _ResolveExpressType;
|
||||
private StringBuilder _Result;
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
private StringBuilder Result
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Result == null) _Result = new StringBuilder();
|
||||
return _Result;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_Result = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region functions
|
||||
public string[] GetResultArray()
|
||||
{
|
||||
if (this._Result == null) return null;
|
||||
return this.Result.ToString().Split(',');
|
||||
}
|
||||
|
||||
public string GetResultString()
|
||||
{
|
||||
if (this._Result == null) return null;
|
||||
return this.Result.ToString();
|
||||
}
|
||||
|
||||
public void Append(string parameter)
|
||||
{
|
||||
switch (this._ResolveExpressType)
|
||||
{
|
||||
case ResolveExpressType.WhereSingle:
|
||||
break;
|
||||
case ResolveExpressType.WhereMultiple:
|
||||
break;
|
||||
case ResolveExpressType.SelectSingle:
|
||||
break;
|
||||
case ResolveExpressType.SelectMultiple:
|
||||
break;
|
||||
case ResolveExpressType.FieldSingle:
|
||||
break;
|
||||
case ResolveExpressType.FieldMultiple:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.Result.Append(parameter);
|
||||
}
|
||||
|
||||
public void AppendFormat(string parameter, params object[] orgs)
|
||||
{
|
||||
this.Result.AppendFormat(parameter, orgs);
|
||||
}
|
||||
|
||||
public void Replace(string parameter, string newValue)
|
||||
{
|
||||
this.Result.Replace(parameter, newValue);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -10,7 +10,8 @@ namespace SqlSugar
|
||||
public class ExpressionContext : ExpResolveAccessory
|
||||
{
|
||||
#region constructor
|
||||
private ExpressionContext() {
|
||||
private ExpressionContext()
|
||||
{
|
||||
|
||||
}
|
||||
public ExpressionContext(Expression expression, ResolveExpressType resolveType)
|
||||
@ -25,13 +26,20 @@ namespace SqlSugar
|
||||
public int Index { get; set; }
|
||||
public ResolveExpressType ResolveType { get; set; }
|
||||
public Expression Expression { get; set; }
|
||||
public StringBuilder ResultString { get; set; }
|
||||
public object ResultObj { get; set; }
|
||||
public bool IsWhereSingle
|
||||
public ExpressionResult Result
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ResolveType == ResolveExpressType.WhereSingle;
|
||||
if (base._Result == null)
|
||||
{
|
||||
this.Result = new ExpressionResult(this.ResolveType);
|
||||
}
|
||||
return base._Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
this._Result = value;
|
||||
}
|
||||
}
|
||||
public List<SugarParameter> Parameters
|
||||
@ -59,21 +67,6 @@ namespace SqlSugar
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public virtual string ToResultString()
|
||||
{
|
||||
BaseResolve resolve = new BaseResolve(new ExpressionParameter() { Expression = this.Expression, Context = this });
|
||||
resolve.Start();
|
||||
if (this.ResultString == null) return string.Empty;
|
||||
return this.ResultString.ToString();
|
||||
}
|
||||
|
||||
public virtual object GetResultObj()
|
||||
{
|
||||
BaseResolve resolve = new BaseResolve(new ExpressionParameter() { Expression = this.Expression, Context = this });
|
||||
resolve.Start();
|
||||
return this.ResultObj;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -98,6 +98,7 @@
|
||||
<Compile Include="Entities\DbColumnInfo.cs" />
|
||||
<Compile Include="Entities\DbTableInfo.cs" />
|
||||
<Compile Include="ExpressionsToSql\Common\BinaryExpressionInfo.cs" />
|
||||
<Compile Include="ExpressionsToSql\Common\ExpressionResult.cs" />
|
||||
<Compile Include="ExpressionsToSql\Common\ExpressionErrorMessage.cs" />
|
||||
<Compile Include="ExpressionsToSql\IDbMethods.cs" />
|
||||
<Compile Include="ExpressionsToSql\ResolveItems\MemberConstExpressionResolve.cs" />
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user