mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
-
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public partial class SqlServerExpressionContext : ExpressionContext
|
||||||
|
{
|
||||||
|
public SqlServerExpressionContext(Expression expression, ResolveExpressType resolveType) : base(expression, resolveType)
|
||||||
|
{
|
||||||
|
base.DbMehtods = new SqlServerMethod();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public partial class SqlServerMethod : DefaultDbMethod, IDbMethods
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -1,34 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SqlSugar
|
|
||||||
{
|
|
||||||
public class SqlServerExpressionContext : ExpressionContext
|
|
||||||
{
|
|
||||||
public SqlServerExpressionContext(Expression expression, ResolveExpressType resolveType) : base(expression, resolveType)
|
|
||||||
{
|
|
||||||
base.DbMehtods = new SqlServerMethod();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public class SqlServerMethod : IDbMethods
|
|
||||||
{
|
|
||||||
public string IsNullOrEmpty(MethodCallExpressionModel model)
|
|
||||||
{
|
|
||||||
var parameter = model.Args[0];
|
|
||||||
if (parameter.IsMember)
|
|
||||||
{
|
|
||||||
return string.Format("( {0}='' OR {0} IS NULL )", parameter.Value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
24
SqlSugar/ExpressionsToSql/Method/DefaultDbMethod.cs
Normal file
24
SqlSugar/ExpressionsToSql/Method/DefaultDbMethod.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
namespace SqlSugar
|
||||||
|
{
|
||||||
|
public partial class DefaultDbMethod : IDbMethods
|
||||||
|
{
|
||||||
|
public virtual string IsNullOrEmpty(MethodCallExpressionModel model)
|
||||||
|
{
|
||||||
|
var parameter = model.Args[0];
|
||||||
|
if (parameter.IsMember)
|
||||||
|
{
|
||||||
|
return string.Format("( {0}='' OR {0} IS NULL )", parameter.Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -99,13 +99,14 @@
|
|||||||
<Compile Include="Entities\DbTableInfo.cs" />
|
<Compile Include="Entities\DbTableInfo.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\CommonTempDataType.cs" />
|
<Compile Include="ExpressionsToSql\Common\CommonTempDataType.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\MethodCallExpressionModel.cs" />
|
<Compile Include="ExpressionsToSql\Common\MethodCallExpressionModel.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Databases\SqlServerExpressionContext.cs" />
|
<Compile Include="ExpressionsToSql\Method\DefaultDbMethod.cs" />
|
||||||
<Compile Include="ExpressionsToSql\NBORM.cs" />
|
<Compile Include="Databases\SqlServer\LambdaExpressions\SqlServerExpressionContext.cs" />
|
||||||
|
<Compile Include="ExpressionsToSql\Method\NBORM.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\BinaryExpressionInfo.cs" />
|
<Compile Include="ExpressionsToSql\Common\BinaryExpressionInfo.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\ExpressionResult.cs" />
|
<Compile Include="ExpressionsToSql\Common\ExpressionResult.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\ExpressionErrorMessage.cs" />
|
<Compile Include="ExpressionsToSql\Common\ExpressionErrorMessage.cs" />
|
||||||
<Compile Include="ExpressionsToSql\Common\ExpressionResultAcceptType.cs" />
|
<Compile Include="ExpressionsToSql\Common\ExpressionResultAcceptType.cs" />
|
||||||
<Compile Include="ExpressionsToSql\IDbMethods.cs" />
|
<Compile Include="ExpressionsToSql\Method\IDbMethods.cs" />
|
||||||
<Compile Include="ExpressionsToSql\ResolveItems\MemberConstExpressionResolve.cs" />
|
<Compile Include="ExpressionsToSql\ResolveItems\MemberConstExpressionResolve.cs" />
|
||||||
<Compile Include="ExpressionsToSql\ResolveItems\MemberInitExpressionResolve.cs" />
|
<Compile Include="ExpressionsToSql\ResolveItems\MemberInitExpressionResolve.cs" />
|
||||||
<Compile Include="ExpressionsToSql\ResolveItems\MemberNewExpressionResolve.cs" />
|
<Compile Include="ExpressionsToSql\ResolveItems\MemberNewExpressionResolve.cs" />
|
||||||
|
Reference in New Issue
Block a user