old_flsystem/类库/SqlSugar/5.0.0.9/Realization/SqlServer/SqlBuilder/SqlServerExpressionContext.cs

38 lines
1.1 KiB
C#
Raw Normal View History

2022-09-20 03:10:29 +00:00
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, ILambdaExpressions
{
public SqlSugarProvider Context { get; set; }
public SqlServerExpressionContext()
{
base.DbMehtods = new SqlServerMethod();
}
}
public partial class SqlServerMethod : DefaultDbMethod, IDbMethods
{
public override string HasValue(MethodCallExpressionModel model)
{
if (model.Args[0].Type == UtilConstants.GuidType)
{
var parameter = model.Args[0];
return string.Format("( {0} IS NOT NULL )", parameter.MemberName);
}
else
{
var parameter = model.Args[0];
return string.Format("( {0}<>'' AND {0} IS NOT NULL )", parameter.MemberName);
}
}
}
}