Exemplo n.º 1
0
        /// <summary>
        /// determines if edmMember is part of the key of it's defining type.
        /// </summary>
        /// <param name="member"></param>
        /// <returns></returns>
        internal static bool IsPartOfKey(EdmMember edmMember)
        {
            if (Helper.IsRelationshipEndMember(edmMember))
            {
                return(((RelationshipType)edmMember.DeclaringType).KeyMembers.Contains(edmMember));
            }

            if (!Helper.IsEdmProperty(edmMember))
            {
                return(false);
            }

            if (Helper.IsEntityTypeBase(edmMember.DeclaringType))
            {
                return(((EntityTypeBase)edmMember.DeclaringType).KeyMembers.Contains(edmMember));
            }

            return(false);
        }
 /// <summary>
 /// Validates a EdmMember object to determine if it can be added to this type's
 /// Members collection. If this method returns without throwing, it is assumed
 /// the member is valid.
 /// </summary>
 /// <param name="member">The member to validate</param>
 /// <exception cref="System.ArgumentException">Thrown if the member is not a EdmProperty</exception>
 internal override void ValidateMemberForAdd(EdmMember member)
 {
     Debug.Assert(Helper.IsEdmProperty(member) || Helper.IsNavigationProperty(member),
                  "Only members of type Property may be added to Entity types.");
 }