You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

2 years ago
  1. using System.Linq;
  2. using System.Linq.Expressions;
  3. namespace SqlSugar
  4. {
  5. public class SubAnd:ISubOperation
  6. {
  7. public string Name
  8. {
  9. get { return "And"; }
  10. }
  11. public Expression Expression
  12. {
  13. get; set;
  14. }
  15. public int Sort
  16. {
  17. get
  18. {
  19. return 401;
  20. }
  21. }
  22. public ExpressionContext Context
  23. {
  24. get;set;
  25. }
  26. public string GetValue(Expression expression)
  27. {
  28. var exp = expression as MethodCallExpression;
  29. var argExp = exp.Arguments[0];
  30. var result = "AND " + SubTools.GetMethodValue(this.Context, argExp, ResolveExpressType.WhereMultiple);
  31. var selfParameterName = this.Context.GetTranslationColumnName((argExp as LambdaExpression).Parameters.First().Name) + UtilConstants.Dot;
  32. result = result.Replace(selfParameterName, string.Empty);
  33. return result;
  34. }
  35. }
  36. }