Пример #1
0
        /// <summary>
        /// returns the member mapping for the given member
        /// </summary>
        /// <param name="propertyName"></param>
        /// <param name="ignoreCase"></param>
        /// <returns></returns>
        private ObjectMemberMapping GetMemberMap(string propertyName, bool ignoreCase)
        {
            EntityUtil.CheckStringArgument(propertyName, "propertyName");
            ObjectMemberMapping memberMapping = null;

            if (!ignoreCase)
            {
                //First get the index of the member map from the clr indexs
                m_memberMapping.TryGetValue(propertyName, out memberMapping);
            }
            else
            {
                foreach (KeyValuePair <string, ObjectMemberMapping> keyValuePair in m_memberMapping)
                {
                    if (keyValuePair.Key.Equals(propertyName, StringComparison.OrdinalIgnoreCase))
                    {
                        if (memberMapping != null)
                        {
                            throw new MappingException(System.Data.Entity.Strings.Mapping_Duplicate_PropertyMap_CaseInsensitive(
                                                           propertyName));
                        }
                        memberMapping = keyValuePair.Value;
                    }
                }
            }

            return(memberMapping);
        }
Пример #2
0
 /// <summary>
 /// Add a member mapping as a child of this object mapping
 /// </summary>
 /// <param name="property">child property mapping to be added</param>
 internal void AddMemberMap(ObjectMemberMapping memberMapping)
 {
     Debug.Assert(memberMapping.ClrMember.Name == memberMapping.EdmMember.Name,
                  "Both clrmember and edmMember name must be the same");
     //Check to see if either the Clr member or the Cdm member specified in this
     //type has already been mapped.
     Debug.Assert(!m_memberMapping.ContainsKey(memberMapping.EdmMember.Name));
     Debug.Assert(!Type.ReferenceEquals(m_memberMapping, EmptyMemberMapping),
                  "Make sure you don't add anything to the static emtpy member mapping");
     m_memberMapping.Add(memberMapping.EdmMember.Name, memberMapping);
 }
Пример #3
0
        /// <summary>
        /// get a MemberMap for the member name specified
        /// </summary>
        /// <param name="cdmPropertyName">the name of the CDM member for which map needs to be retrieved</param>
        internal ObjectPropertyMapping GetPropertyMap(String propertyName)
        {
            ObjectMemberMapping memberMapping = GetMemberMap(propertyName, false /*ignoreCase*/);

            if (memberMapping != null &&
                memberMapping.MemberMappingKind == MemberMappingKind.ScalarPropertyMapping ||
                memberMapping.MemberMappingKind == MemberMappingKind.ComplexPropertyMapping)
            {
                return((ObjectPropertyMapping)memberMapping);
            }

            return(null);
        }
 /// <summary>
 /// Add a member mapping as a child of this object mapping
 /// </summary>
 /// <param name="property">child property mapping to be added</param>
 internal void AddMemberMap(ObjectMemberMapping memberMapping) {
     Debug.Assert(memberMapping.ClrMember.Name == memberMapping.EdmMember.Name,
         "Both clrmember and edmMember name must be the same");
     //Check to see if either the Clr member or the Cdm member specified in this 
     //type has already been mapped.
     Debug.Assert(!m_memberMapping.ContainsKey(memberMapping.EdmMember.Name));
     Debug.Assert(!Type.ReferenceEquals(m_memberMapping, EmptyMemberMapping),
         "Make sure you don't add anything to the static emtpy member mapping");
     m_memberMapping.Add(memberMapping.EdmMember.Name, memberMapping);
 }