Exemplo n.º 1
0
        // <summary>
        // returns the member mapping for the given member
        // </summary>
        private ObjectMemberMapping GetMemberMap(string propertyName, bool ignoreCase)
        {
            Check.NotEmpty(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 (var keyValuePair in m_memberMapping)
                {
                    if (keyValuePair.Key.Equals(propertyName, StringComparison.OrdinalIgnoreCase))
                    {
                        if (memberMapping != null)
                        {
                            throw new MappingException(
                                      Strings.Mapping_Duplicate_PropertyMap_CaseInsensitive(
                                          propertyName));
                        }
                        memberMapping = keyValuePair.Value;
                    }
                }
            }

            return(memberMapping);
        }
Exemplo n.º 2
0
        private ObjectMemberMapping GetMemberMap(
            string propertyName,
            bool ignoreCase)
        {
            Check.NotEmpty(propertyName, nameof(propertyName));
            ObjectMemberMapping objectMemberMapping = (ObjectMemberMapping)null;

            if (!ignoreCase)
            {
                this.m_memberMapping.TryGetValue(propertyName, out objectMemberMapping);
            }
            else
            {
                foreach (KeyValuePair <string, ObjectMemberMapping> keyValuePair in this.m_memberMapping)
                {
                    if (keyValuePair.Key.Equals(propertyName, StringComparison.OrdinalIgnoreCase))
                    {
                        if (objectMemberMapping != null)
                        {
                            throw new MappingException(Strings.Mapping_Duplicate_PropertyMap_CaseInsensitive((object)propertyName));
                        }
                        objectMemberMapping = keyValuePair.Value;
                    }
                }
            }
            return(objectMemberMapping);
        }
Exemplo n.º 3
0
        internal ObjectPropertyMapping GetPropertyMap(string propertyName)
        {
            ObjectMemberMapping memberMap = this.GetMemberMap(propertyName, false);

            if (memberMap != null && memberMap.MemberMappingKind == MemberMappingKind.ScalarPropertyMapping || memberMap.MemberMappingKind == MemberMappingKind.ComplexPropertyMapping)
            {
                return((ObjectPropertyMapping)memberMap);
            }
            return((ObjectPropertyMapping)null);
        }
Exemplo n.º 4
0
 // <summary>
 // Add a member mapping as a child of this object mapping
 // </summary>
 // <param name="memberMapping"> 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(
         !ReferenceEquals(m_memberMapping, EmptyMemberMapping),
         "Make sure you don't add anything to the static emtpy member mapping");
     m_memberMapping.Add(memberMapping.EdmMember.Name, memberMapping);
 }
 /// <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(
         !ReferenceEquals(m_memberMapping, EmptyMemberMapping),
         "Make sure you don't add anything to the static emtpy member mapping");
     m_memberMapping.Add(memberMapping.EdmMember.Name, memberMapping);
 }
Exemplo n.º 6
0
 internal void AddMemberMap(ObjectMemberMapping memberMapping)
 {
     this.m_memberMapping.Add(memberMapping.EdmMember.Name, memberMapping);
 }