示例#1
0
        /// <summary>Initializes a new <see cref="ProjectionPathSegment"/> instance.</summary>
        /// <param name="startPath">Path on which this segment is located.</param>
        /// <param name="member">Name of member to access when traversing a property; possibly null.</param>
        /// <param name="projectionType">
        /// Type that we expect to project out; typically the same as <paramref name="member"/>, but may be adjusted.
        /// </param>
        internal ProjectionPathSegment(ProjectionPath startPath, string member, Type projectionType)
        {
            Debug.Assert(startPath != null, "startPath != null");

            this.Member         = member;
            this.StartPath      = startPath;
            this.ProjectionType = projectionType;
        }
示例#2
0
        /// <summary>Initializes a new <see cref="ProjectionPathSegment"/> instance.</summary>
        /// <param name="startPath">Path on which this segment is located.</param>
        /// <param name="memberExpression">Member expression for the projection path; possibly null.</param>
        internal ProjectionPathSegment(ProjectionPath startPath, MemberExpression memberExpression)
        {
            Debug.Assert(startPath != null, "startPath != null");
            Debug.Assert(memberExpression != null, "memberExpression != null");

            this.StartPath = startPath;

            Expression source = ResourceBinder.StripTo <Expression>(memberExpression.Expression);

            this.Member         = ClientTypeUtil.GetServerDefinedName(memberExpression.Member);
            this.ProjectionType = memberExpression.Type;
            this.SourceTypeAs   = source.NodeType == ExpressionType.TypeAs ? source.Type : null;
        }