コード例 #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:
                    // 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();
        }
コード例 #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:
                    NonEntityProjectionAnalyzer.Analyze(e.Body, pb);
                    break;
                }
            }

            pb.PopParamExpression();
        }
コード例 #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();
        }
コード例 #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);
     }
 }
コード例 #5
0
 private static void Analyze(MemberInitExpression mie, PathBox pb)
 {
     if (CommonUtil.IsClientType(mie.Type))
     {
         EntityProjectionAnalyzer.Analyze(mie, pb);
     }
     else
     {
         NonEntityProjectionAnalyzer.Analyze(mie, pb);
     }
 }
コード例 #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);
            }
        }
コード例 #7
0
        /// <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);
            }
        }
コード例 #8
0
        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();
            }
        }
コード例 #9
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();
            }
        }