Example #1
0
        internal static void Analyze(LambdaExpression e, PathBox pb)
        {
            bool knownEntityType = ClientType.CheckElementTypeIsEntity(e.Body.Type);

            pb.PushParamExpression(e.Parameters.Last());

            if (!knownEntityType)
            {
                NonEntityProjectionAnalyzer.Analyze(e.Body, pb);
            }
            else
            {
                switch (e.Body.NodeType)
                {
                case ExpressionType.MemberInit:
                    EntityProjectionAnalyzer.Analyze((MemberInitExpression)e.Body, pb);
                    break;

                case ExpressionType.New:
                    throw new NotSupportedException(Strings.ALinq_CannotConstructKnownEntityTypes);

                case ExpressionType.Constant:
                    throw new NotSupportedException(Strings.ALinq_CannotCreateConstantEntity);

                default:
                    NonEntityProjectionAnalyzer.Analyze(e.Body, pb);
                    break;
                }
            }

            pb.PopParamExpression();
        }
Example #2
0
        internal static void Analyze(LambdaExpression e, PathBox pb)
        {
            bool knownEntityType = ClientType.CheckElementTypeIsEntity(e.Body.Type);

            pb.PushParamExpression(e.Parameters.Last());

            if (!knownEntityType)
            {
                NonEntityProjectionAnalyzer.Analyze(e.Body, pb);
            }
            else
            {
                switch (e.Body.NodeType)
                {
                case ExpressionType.MemberInit:
                    EntityProjectionAnalyzer.Analyze((MemberInitExpression)e.Body, pb);
                    break;

                case ExpressionType.New:
                    throw new NotSupportedException(Strings.ALinq_CannotConstructKnownEntityTypes);

                case ExpressionType.Constant:
                    throw new NotSupportedException(Strings.ALinq_CannotCreateConstantEntity);

                default:
                    // ExpressionType.MemberAccess as a top-level expression is correctly
                    // processed here, as the lambda isn't being member-initialized.
                    NonEntityProjectionAnalyzer.Analyze(e.Body, pb);
                    break;
                }
            }

            pb.PopParamExpression();
        }
Example #3
0
        internal static void Analyze(LambdaExpression e, PathBox pb)
        {
            bool num = CommonUtil.IsClientType(e.Body.Type);

            pb.PushParamExpression(e.Parameters.Last());
            if (!num)
            {
                NonEntityProjectionAnalyzer.Analyze(e.Body, pb);
            }
            else
            {
                switch (e.Body.NodeType)
                {
                case ExpressionType.MemberInit:
                    EntityProjectionAnalyzer.Analyze((MemberInitExpression)e.Body, pb);
                    break;

                case ExpressionType.New:
                    throw new NotSupportedException("Construction of entity type instances must use object initializer with default constructor.");

                case ExpressionType.Constant:
                    throw new NotSupportedException("Referencing of local entity type instances not supported when projecting results.");

                default:
                    NonEntityProjectionAnalyzer.Analyze(e.Body, pb);
                    break;
                }
            }
            pb.PopParamExpression();
        }
Example #4
0
 private static void Analyze(MemberInitExpression mie, PathBox pb, DataServiceContext context)
 {
     if (ClientTypeUtil.TypeOrElementTypeIsEntity(mie.Type))
     {
         EntityProjectionAnalyzer.Analyze(mie, pb, context);
     }
     else
     {
         NonEntityProjectionAnalyzer.Analyze(mie, pb, context);
     }
 }
Example #5
0
 private static void Analyze(MemberInitExpression mie, PathBox pb)
 {
     if (CommonUtil.IsClientType(mie.Type))
     {
         EntityProjectionAnalyzer.Analyze(mie, pb);
     }
     else
     {
         NonEntityProjectionAnalyzer.Analyze(mie, pb);
     }
 }
Example #6
0
        private static void Analyze(MemberInitExpression mie, PathBox pb)
        {
            Debug.Assert(mie != null, "mie != null");
            Debug.Assert(pb != null, "pb != null");

            bool knownEntityType = ClientType.CheckElementTypeIsEntity(mie.Type);

            if (knownEntityType)
            {
                EntityProjectionAnalyzer.Analyze(mie, pb);
            }
            else
            {
                NonEntityProjectionAnalyzer.Analyze(mie, pb);
            }
        }
        /// <summary>
        /// Analyzes the specified expression with an entity-projection or
        /// non-entity-projection analyzer.
        /// </summary>
        /// <param name="mie">Expression to analyze.</param>
        /// <param name="pb">Path box where select and expand paths are tracked.</param>
        /// <param name="context">Context of expression to analyze.</param>
        private static void Analyze(MemberInitExpression mie, SelectExpandPathBuilder pb, DataServiceContext context)
        {
            Debug.Assert(mie != null, "mie != null");
            Debug.Assert(pb != null, "pb != null");

            bool knownEntityType = ClientTypeUtil.TypeOrElementTypeIsEntity(mie.Type);

            if (knownEntityType)
            {
                EntityProjectionAnalyzer.Analyze(mie, pb, context);
            }
            else
            {
                NonEntityProjectionAnalyzer.Analyze(mie, pb, context);
            }
        }
        private static void Analyze(LambdaExpression e, SelectExpandPathBuilder pb, DataServiceContext context)
        {
            bool knownEntityType   = ClientTypeUtil.TypeOrElementTypeIsEntity(e.Body.Type);
            ParameterExpression pe = e.Parameters.Last();
            bool isEntityParameter = ClientTypeUtil.TypeOrElementTypeIsEntity(pe.Type);

            if (isEntityParameter)
            {
                pb.PushParamExpression(pe);
            }

            if (!knownEntityType)
            {
                NonEntityProjectionAnalyzer.Analyze(e.Body, pb, context);
            }
            else
            {
                switch (e.Body.NodeType)
                {
                case ExpressionType.MemberInit:
                    EntityProjectionAnalyzer.Analyze((MemberInitExpression)e.Body, pb, context);
                    break;

                case ExpressionType.New:
                    throw new NotSupportedException(Strings.ALinq_CannotConstructKnownEntityTypes);

                case ExpressionType.Constant:
                    throw new NotSupportedException(Strings.ALinq_CannotCreateConstantEntity);

                default:
                    // ExpressionType.MemberAccess as a top-level expression is correctly
                    // processed here, as the lambda isn't being member-initialized.
                    NonEntityProjectionAnalyzer.Analyze(e.Body, pb, context);
                    break;
                }
            }

            if (isEntityParameter)
            {
                pb.PopParamExpression();
            }
        }
Example #9
0
            internal static void Analyze(Expression e, PathBox pb)
            {
                NonEntityProjectionAnalyzer nonEntityProjectionAnalyzer = new NonEntityProjectionAnalyzer(pb, e.Type);
                MemberInitExpression        memberInitExpression        = e as MemberInitExpression;

                if (memberInitExpression != null)
                {
                    foreach (MemberBinding binding in memberInitExpression.Bindings)
                    {
                        MemberAssignment memberAssignment = binding as MemberAssignment;
                        if (memberAssignment != null)
                        {
                            nonEntityProjectionAnalyzer.Visit(memberAssignment.Expression);
                        }
                    }
                }
                else
                {
                    nonEntityProjectionAnalyzer.Visit(e);
                }
            }
Example #10
0
            internal static void Analyze(Expression e, PathBox pb)
            {
                var nepa = new NonEntityProjectionAnalyzer(pb, e.Type);

                MemberInitExpression mie = e as MemberInitExpression;

                if (mie != null)
                {
                    foreach (MemberBinding mb in mie.Bindings)
                    {
                        MemberAssignment ma = mb as MemberAssignment;
                        if (ma != null)
                        {
                            nepa.Visit(ma.Expression);
                        }
                    }
                }
                else
                {
                    nepa.Visit(e);
                }
            }
            internal static void Analyze(Expression e, SelectExpandPathBuilder pb, DataServiceContext context)
            {
                var nepa = new NonEntityProjectionAnalyzer(pb, e.Type, context);

                MemberInitExpression mie = e as MemberInitExpression;

                if (mie != null)
                {
                    foreach (MemberBinding mb in mie.Bindings)
                    {
                        MemberAssignment ma = mb as MemberAssignment;
                        if (ma != null)
                        {
                            nepa.Visit(ma.Expression);
                        }
                    }
                }
                else
                {
                    nepa.Visit(e);
                }
            }
Example #12
0
        private static void Analyze(LambdaExpression e, PathBox pb, DataServiceContext context)
        {
            bool flag = ClientTypeUtil.TypeOrElementTypeIsEntity(e.Body.Type);
            ParameterExpression pe = e.Parameters.Last <ParameterExpression>();
            bool flag2             = ClientTypeUtil.TypeOrElementTypeIsEntity(pe.Type);

            if (flag2)
            {
                pb.PushParamExpression(pe);
            }
            if (!flag)
            {
                NonEntityProjectionAnalyzer.Analyze(e.Body, pb, context);
            }
            else
            {
                switch (e.Body.NodeType)
                {
                case ExpressionType.Constant:
                    throw new NotSupportedException(System.Data.Services.Client.Strings.ALinq_CannotCreateConstantEntity);

                case ExpressionType.MemberInit:
                    EntityProjectionAnalyzer.Analyze((MemberInitExpression)e.Body, pb, context);
                    goto Label_0099;

                case ExpressionType.New:
                    throw new NotSupportedException(System.Data.Services.Client.Strings.ALinq_CannotConstructKnownEntityTypes);
                }
                NonEntityProjectionAnalyzer.Analyze(e.Body, pb, context);
            }
Label_0099:
            if (flag2)
            {
                pb.PopParamExpression();
            }
        }
Example #13
0
            internal static void Analyze(Expression e, PathBox pb)
            {
                var nepa = new NonEntityProjectionAnalyzer(pb, e.Type);

                MemberInitExpression mie = e as MemberInitExpression;

                if (mie != null)
                {
                    foreach (MemberBinding mb in mie.Bindings)
                    {
                        MemberAssignment ma = mb as MemberAssignment;
                        if (ma != null)
                        {
                            nepa.Visit(ma.Expression);
                        }
                    }
                }
                else
                {
                    nepa.Visit(e);
                }
            }
Example #14
0
            internal static void Analyze(Expression e, SelectExpandPathBuilder pb, DataServiceContext context)
            {
                var nepa = new NonEntityProjectionAnalyzer(pb, e.Type, context);

                MemberInitExpression mie = e as MemberInitExpression;

                if (mie != null)
                {
                    foreach (MemberBinding mb in mie.Bindings)
                    {
                        MemberAssignment ma = mb as MemberAssignment;
                        if (ma != null)
                        {
                            nepa.Visit(ma.Expression);
                        }
                    }
                }
                else
                {
                    nepa.Visit(e);
                }
            }