src/Misc/EFTools/EntityDesignModel/Commands/UpdateConceptualAndMappingModelsCommand.cs
/// <summary>
///     In the existing artifact create a new C-side Property
///     in the existing EntityType  plus a mapping based on the
///     C-side and S-side Properties in the temp artifact
/// </summary>
In the existing artifact create a new C-side Property
in the existing EntityType  plus a mapping based on the
C-side and S-side Properties in the temp artifact
In the existing artifact create a new C - side Property in the existing EntityType plus a mapping based on the C - side and S - side Properties in the temp artifact
private Property CreateNewConceptualPropertyAndMapping(
            CommandProcessorContext cpc,
            Property cSidePropInTempArtifact, Property sSidePropInTempArtifact,
            EntityType existingEntityType)
        {
            Debug.Assert(cSidePropInTempArtifact != null, "Null C-side Property");
            Debug.Assert(cSidePropInTempArtifact.EntityType.EntityModel.IsCSDL, "cSidePropInTempArtifact must be C-side");
            Debug.Assert(sSidePropInTempArtifact != null, "Null S-side Property");
            Debug.Assert(!sSidePropInTempArtifact.EntityType.EntityModel.IsCSDL, "sSidePropInTempArtifact must be S-side");
            Debug.Assert(existingEntityType != null, "Null existing EntityType");
            Debug.Assert(existingEntityType.EntityModel.IsCSDL, "Existing EntityType must be C-side");
            var pcf = new PropertyClipboardFormat(cSidePropInTempArtifact);
            Debug.Assert(
                pcf != null, "Could not construct PropertyClipboardFormat for C-side Property " + cSidePropInTempArtifact.ToPrettyString());
            if (null == pcf)
            {
                return null;
            }
            else
            {
                var sSidePropInExistingArtifact =
                    FindSSidePropInExistingArtifact(sSidePropInTempArtifact);
                Debug.Assert(
                    null != sSidePropInExistingArtifact,
                    "Cannot find S-side Property matching the one in the temp artifact " + sSidePropInTempArtifact.ToPrettyString());
                var cmd = new CopyPropertyCommand(pcf, existingEntityType);
                CommandProcessor.InvokeSingleCommand(cpc, cmd);
                var cSidePropInExistingArtifact = cmd.Property;
                if (null != cSidePropInExistingArtifact
                    && null != sSidePropInExistingArtifact)
                {
                    var cmd2 =
                        new CreateFragmentScalarPropertyCommand(
                            existingEntityType,
                            cSidePropInExistingArtifact, sSidePropInExistingArtifact);
                    CommandProcessor.InvokeSingleCommand(cpc, cmd2);
                }
                return cSidePropInExistingArtifact;
            }
        }
private Property CreateNewConceptualPropertyAndMapping ( CommandProcessorContext cpc , Property cSidePropInTempArtifact , Property sSidePropInTempArtifact , EntityType existingEntityType ) { Debug . Assert ( cSidePropInTempArtifact != null , " " ) ; Debug . Assert ( cSidePropInTempArtifact . EntityType . EntityModel . IsCSDL , " " ) ; Debug . Assert ( sSidePropInTempArtifact != null , " " ) ; Debug . Assert ( ! sSidePropInTempArtifact . EntityType . EntityModel . IsCSDL , " " ) ; Debug . Assert ( existingEntityType != null , " " ) ; Debug . Assert ( existingEntityType . EntityModel . IsCSDL , " " ) ; var pcf = new PropertyClipboardFormat ( cSidePropInTempArtifact ) ; Debug . Assert ( pcf != null , " " + cSidePropInTempArtifact . ToPrettyString ( ) ) ; if ( null == pcf ) { return null ; } else { var sSidePropInExistingArtifact = FindSSidePropInExistingArtifact ( sSidePropInTempArtifact ) ; Debug . Assert ( null != sSidePropInExistingArtifact , " " + sSidePropInTempArtifact . ToPrettyString ( ) ) ; var cmd = new CopyPropertyCommand ( pcf , existingEntityType ) ; CommandProcessor . InvokeSingleCommand ( cpc , cmd ) ; var cSidePropInExistingArtifact = cmd . Property ; if ( null != cSidePropInExistingArtifact && null != sSidePropInExistingArtifact ) { var cmd2 = new CreateFragmentScalarPropertyCommand ( existingEntityType , cSidePropInExistingArtifact , sSidePropInExistingArtifact ) ; CommandProcessor . InvokeSingleCommand ( cpc , cmd2 ) ; } return cSidePropInExistingArtifact ; } }
In the existing artifact create a new C-side Property
in the existing EntityType  plus a mapping based on the
C-side and S-side Properties in the temp artifact
In the existing artifact create a new C - side Property in the existing EntityType plus a mapping based on the C - side and S - side Properties in the temp artifact
// store off matching S-side property in the existing  // artifact for mapping below // create the C-side Property in the existing artifact // now create the mapping for the C-side Property just created
cpc
CommandProcessorContext
cSidePropInTempArtifact
Property
sSidePropInTempArtifact
Property
existingEntityType
EntityType