예제 #1
0
        private static void HandleSetOperation(Select select, MethodCallExpression expression, bool intersect, Func <IQueryable <T>, string> getTableName)
        {
            if (select.SetOperatons == null)
            {
                select.SetOperatons = new List <SetOperation>();
            }
            var setOperationSource = CreateModel(expression.ArgumentAt(2), getTableName).Select;

            setOperationSource.Top     = 1;
            setOperationSource.TopType = Select.TopValueType.Count;
            var operatorExpressions = expression.ArgumentAt <NewArrayExpression>(3).
                                      Expressions.
                                      Select(x => x.NodeType == ExpressionType.Quote ? ((UnaryExpression)x).Operand : x).
                                      Select(x => ((LambdaExpression)x).Body).
                                      Select(x => x.NodeType == ExpressionType.Convert ? ((UnaryExpression)x).Operand : x);
            var operators = operatorExpressions.Select(x => Operator.Create.Equal(Operand.Create.Projection(ProjectionVisitor <T> .CreateModel(x)),
                                                                                  Operand.Create.Projection(ProjectionVisitor <T> .CreateModel(x, select.From.Alias))));

            foreach (var @operator in operators)
            {
                setOperationSource.Where = setOperationSource.HasWhere ? Operator.Create.Operators(setOperationSource.Where, Operator.OperatorType.And, @operator) : @operator;
            }
            setOperationSource.Projection = operatorExpressions.Select(x => SelectProjection.Create(ProjectionVisitor <T> .CreateModel(x))).ToList();
            select.SetOperatons.Add(new SetOperation {
                Type   = intersect ? SetOperation.OperationType.Intersect : SetOperation.OperationType.Compliment,
                Select = setOperationSource
            });
        }
예제 #2
0
 public virtual SelectProjection ProjectProperties(LambdaExpression p)
 {
     Visit(p);
     Projection = Properties.Count == 0
                       ? new SelectProjection(MappedProperties, p)
                       : new SelectProjection(Properties, p);
     return(Projection);
 }
 public ProjectionQueryCommandOptions(IObjectMapping mapping, SelectProjection selectProjection) : base(selectProjection)
 {
     _mapping = mapping;
 }
예제 #4
0
 protected QueryCommandOptions(SelectProjection selectProjection)
 {
     SelectProjection = selectProjection;
     AttributesToLoad = selectProjection.SelectedProperties;
 }
 public ProjectionResultTransformer(SelectProjection selectProjection, IDictionary <string, string> queriedProperties, IObjectMapping mapping)
     : base(queriedProperties, mapping, queriedProperties.Count == mapping.Properties.Count && selectProjection.ReturnType == mapping.Type)
 {
     _selectProjection = selectProjection;
 }
 public DynamicQueryCommandOptions(SelectProjection projection)
     : base(projection == null ? new Dictionary <string, string>() : projection.SelectedProperties)
 {
     _projection = projection;
 }
예제 #7
0
 public DynamicResultTransformer(SelectProjection projection = null)
 {
     _projection = projection;
 }