Пример #1
0
        internal static IEnumerable <TypeMapping> GetMappingsForEntitySetAndType(
            StorageMappingItemCollection mappingCollection,
            EntityContainer container,
            EntitySetBase entitySet,
            EntityTypeBase entityType)
        {
            EntityContainerMapping containerMapping = MappingMetadataHelper.GetEntityContainerMap(mappingCollection, container);
            EntitySetBaseMapping   extentMap        = containerMapping.GetSetMapping(entitySet.Name);

            if (extentMap != null)
            {
                foreach (TypeMapping typeMapping in extentMap.TypeMappings.Where <TypeMapping>((Func <TypeMapping, bool>)(map => map.Types.Union <EntityTypeBase>((IEnumerable <EntityTypeBase>)map.IsOfTypes).Contains <EntityTypeBase>(entityType))))
                {
                    yield return(typeMapping);
                }
            }
        }
Пример #2
0
        internal static IEnumerable <EntityTypeModificationFunctionMapping> GetModificationFunctionMappingsForEntitySetAndType(
            StorageMappingItemCollection mappingCollection,
            EntityContainer container,
            EntitySetBase entitySet,
            EntityTypeBase entityType)
        {
            EntityContainerMapping containerMapping = MappingMetadataHelper.GetEntityContainerMap(mappingCollection, container);
            EntitySetBaseMapping   extentMap        = containerMapping.GetSetMapping(entitySet.Name);
            EntitySetMapping       entitySetMapping = extentMap as EntitySetMapping;

            if (entitySetMapping != null && entitySetMapping != null)
            {
                foreach (EntityTypeModificationFunctionMapping modificationFunctionMapping in entitySetMapping.ModificationFunctionMappings.Where <EntityTypeModificationFunctionMapping>((Func <EntityTypeModificationFunctionMapping, bool>)(functionMap => functionMap.EntityType.Equals((object)entityType))))
                {
                    yield return(modificationFunctionMapping);
                }
            }
        }