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.

40 lines
775 B

2 years ago
  1. using System.Linq.Expressions;
  2. namespace SqlSugar
  3. {
  4. public class SubAvg: ISubOperation
  5. {
  6. public string Name
  7. {
  8. get
  9. {
  10. return "Avg";
  11. }
  12. }
  13. public Expression Expression
  14. {
  15. get; set;
  16. }
  17. public int Sort
  18. {
  19. get
  20. {
  21. return 200;
  22. }
  23. }
  24. public ExpressionContext Context
  25. {
  26. get; set;
  27. }
  28. public string GetValue(Expression expression = null)
  29. {
  30. var exp = expression as MethodCallExpression;
  31. return "AVG(" + SubTools.GetMethodValue(this.Context, exp.Arguments[0], ResolveExpressType.FieldSingle) + ")";
  32. }
  33. }
  34. }