public static MappingFragment GetMapping <T>(this MetadataWorkspace metadataWorkspace)
        {
            EntityType entityType = metadataWorkspace.GetObjectSpaceEntityByType <T>();

            EntitySet entitySet = metadataWorkspace.GetItems <EntityContainer>(DataSpace.CSpace)
                                  .SelectMany(x => x.EntitySets)
                                  .FirstOrDefault(x => x.ElementType.Name == entityType.Name);

            EntitySetMapping entitySetMapping = metadataWorkspace.GetItems <EntityContainerMapping>(DataSpace.CSSpace)
                                                .SelectMany(x => x.EntitySetMappings)
                                                .First(x => x.EntitySet == entitySet);

            MappingFragment mappingFragment = entitySetMapping.EntityTypeMappings.SelectMany(x => x.Fragments)
                                              .First();

            return(mappingFragment);
        }