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.

46 lines
1.0 KiB

2 years ago
  1. using System.Linq.Expressions;
  2. namespace SqlSugar
  3. {
  4. public class SubSelect : ISubOperation
  5. {
  6. public string Name
  7. {
  8. get
  9. {
  10. return "Select";
  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. var entityType = (exp.Arguments[0] as LambdaExpression).Parameters[0].Type;
  32. if (this.Context.InitMappingInfo != null)
  33. {
  34. this.Context.InitMappingInfo(entityType);
  35. this.Context.RefreshMapping();
  36. }
  37. return SubTools.GetMethodValue(this.Context, exp.Arguments[0],ResolveExpressType.FieldSingle);
  38. }
  39. }
  40. }