src/Misc/EFTools/EntityDesignModel/Commands/CreateEntityTypeMappingCommand.cs
/// <summary>
///     Creates a new EntityTypeMapping in the existing EntitySetMapping
///     based on another EntityTypeMapping (etmToClone) in a different artifact.
///     All the other parameters are presumed to already exist in the same artifact
///     as the EntitySetMapping.
/// </summary>
Creates a new EntityTypeMapping in the existing EntitySetMapping
based on another EntityTypeMapping (etmToClone) in a different artifact.
All the other parameters are presumed to already exist in the same artifact
as the EntitySetMapping.
Creates a new EntityTypeMapping in the existing EntitySetMapping based on another EntityTypeMapping ( etmToClone ) in a different artifact . All the other parameters are presumed to already exist in the same artifact as the EntitySetMapping .
internal static EntityTypeMapping CloneEntityTypeMapping(
            CommandProcessorContext cpc,
            EntityTypeMapping etmToClone, EntitySetMapping existingEntitySetMapping,
            ConceptualEntityType existingEntityType, EntityTypeMappingKind kind)
        {
            var createETM = new CreateEntityTypeMappingCommand(existingEntitySetMapping, existingEntityType, kind);
            var cp = new CommandProcessor(cpc, createETM);
            cp.Invoke();
            var etm = createETM.EntityTypeMapping;
            foreach (var mappingFragment in etmToClone.MappingFragments())
            {
                var sesToClone = mappingFragment.StoreEntitySet.Target as StorageEntitySet;
                var ses = existingEntitySetMapping.EntityContainerMapping.Artifact.
                              StorageModel().FirstEntityContainer.GetFirstNamedChildByLocalName(sesToClone.LocalName.Value)
                          as StorageEntitySet;
                CreateMappingFragmentCommand.CloneMappingFragment(cpc, mappingFragment, etm, ses);
            }
            return etm;
        }
internal static EntityTypeMapping CloneEntityTypeMapping ( CommandProcessorContext cpc , EntityTypeMapping etmToClone , EntitySetMapping existingEntitySetMapping , ConceptualEntityType existingEntityType , EntityTypeMappingKind kind ) { var createETM = new CreateEntityTypeMappingCommand ( existingEntitySetMapping , existingEntityType , kind ) ; var cp = new CommandProcessor ( cpc , createETM ) ; cp . Invoke ( ) ; var etm = createETM . EntityTypeMapping ; foreach ( var mappingFragment in etmToClone . MappingFragments ( ) ) { var sesToClone = mappingFragment . StoreEntitySet . Target as StorageEntitySet ; var ses = existingEntitySetMapping . EntityContainerMapping . Artifact . StorageModel ( ) . FirstEntityContainer . GetFirstNamedChildByLocalName ( sesToClone . LocalName . Value ) as StorageEntitySet ; CreateMappingFragmentCommand . CloneMappingFragment ( cpc , mappingFragment , etm , ses ) ; } return etm ; }
Creates a new EntityTypeMapping in the existing EntitySetMapping
based on another EntityTypeMapping (etmToClone) in a different artifact.
Creates a new EntityTypeMapping in the existing EntitySetMapping based on another EntityTypeMapping ( etmToClone ) in a different artifact .
cpc
CommandProcessorContext
etmToClone
EntityTypeMapping
existingEntitySetMapping
EntitySetMapping
existingEntityType
ConceptualEntityType
kind
EntityTypeMappingKind