Exemplo n.º 1
0
            public SubQueryFilterParser(WhereClauseParser parent, SubQueryExpression expression)
            {
                _parent     = parent;
                _expression = expression;

                foreach (var @operator in expression.QueryModel.ResultOperators)
                {
                    switch (@operator)
                    {
                    case AnyResultOperator _:
                        Usage = SubQueryUsage.Any;

                        break;

                    case CountResultOperator _:
                        Usage = SubQueryUsage.Count;
                        break;

                    case LongCountResultOperator _:
                        Usage = SubQueryUsage.Count;
                        break;

                    case DistinctResultOperator _:
                        _isDistinct = true;
                        break;

                    case ContainsResultOperator op:
                        Usage = op.Item is QuerySourceReferenceExpression
                                ? SubQueryUsage.Intersect
                                : SubQueryUsage.Contains;

                        _contains = op.Item;
                        break;

                    // TODO -- add Min/Max/Avg/Sum operators?

                    default:
                        throw new BadLinqExpressionException($"Invalid result operator {@operator} in sub query '{expression}'");
                    }
                }

                _wheres = expression.QueryModel.BodyClauses.OfType <WhereClause>().ToArray();
            }
Exemplo n.º 2
0
 public BinaryExpressionVisitor(WhereClauseParser parent)
 {
     _parent = parent;
 }