Exemple #1
0
        internal static ObjectTypeMapping LoadObjectMapping(
            EdmType cdmType,
            EdmType objectType,
            DefaultObjectMappingItemCollection ocItemCollection)
        {
            Dictionary <string, ObjectTypeMapping> typeMappings = new Dictionary <string, ObjectTypeMapping>((IEqualityComparer <string>)StringComparer.Ordinal);
            ObjectTypeMapping objectTypeMapping = DefaultObjectMappingItemCollection.LoadObjectMapping(cdmType, objectType, ocItemCollection, typeMappings);

            ocItemCollection?.AddInternalMappings((IEnumerable <ObjectTypeMapping>)typeMappings.Values);
            return(objectTypeMapping);
        }
        // <summary>
        // The method fills up the children of ObjectMapping. It goes through the
        // members in CDM type and finds the member in Object space with the same name
        // and creates a member map between them. These member maps are added
        // as children of the object mapping.
        // </summary>
        internal static ObjectTypeMapping LoadObjectMapping(
            EdmType cdmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection)
        {
            var typeMappings = new Dictionary <string, ObjectTypeMapping>(StringComparer.Ordinal);
            var typeMapping  = LoadObjectMapping(cdmType, objectType, ocItemCollection, typeMappings);

            // If DefaultOCMappingItemCollection is not null, add all the type mappings to the item collection
            if (ocItemCollection != null)
            {
                ocItemCollection.AddInternalMappings(typeMappings.Values);
            }

            return(typeMapping);
        }
        // <summary>
        // The method fills up the children of ObjectMapping. It goes through the
        // members in CDM type and finds the member in Object space with the same name
        // and creates a member map between them. These member maps are added
        // as children of the object mapping.
        // </summary>
        internal static ObjectTypeMapping LoadObjectMapping(
            EdmType cdmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection)
        {
            var typeMappings = new Dictionary<string, ObjectTypeMapping>(StringComparer.Ordinal);
            var typeMapping = LoadObjectMapping(cdmType, objectType, ocItemCollection, typeMappings);

            // If DefaultOCMappingItemCollection is not null, add all the type mappings to the item collection
            if (ocItemCollection != null)
            {
                ocItemCollection.AddInternalMappings(typeMappings.Values);
            }

            return typeMapping;
        }