internal static void BuildMapping_EntitySet(SchemaMapping mapping, Schema conceptual, Schema storage)
        {
            mapping.EntityContainerMapping.EntitySetMappings.ForEach(x =>
            {
                // SET Entity Set
                var conceptualSet = conceptual.EntityContainer.Index_EntitySets_Name[x.Name];
                x.ConceptualSet = conceptualSet;

                x.EntityTypeMappings.ForEach(y =>
                {
                    if (y.MappingFragment != null)
                    {
                        var isGenericType = y.TypeName.StartsWith("IsTypeOf(");

                        var typeName = isGenericType ? y.TypeName.SubstringLastIndexOf(".").Replace(")", "") : y.TypeName.SubstringLastIndexOf(".");
                        var entityType = conceptual.Index_EntityTypes_Name[typeName];
                        y.EntityType = entityType;
                        entityType.EntityTypeMapping = y;

                        if (isGenericType)
                        {
                            entityType.GenericEntitySetMapping = y;
                        }

                        var storeEntitySet = storage.EntityContainer.Index_EntitySets_Name[y.MappingFragment.StoreEntitySetName];
                        y.MappingFragment.StoreEntitySet = storeEntitySet;
                    }
                });
            });
        }
 internal static void BuildMapping(SchemaMapping mapping, Schema conceptual, Schema storage)
 {
     BuildMapping_EntitySet(mapping, conceptual, storage);
 }