src/Misc/EFTools/EntityDesignModel/Commands/UpdateConceptualAndMappingModelsCommand.cs
/// <summary>
///     Construct the list of those C-side Associations which are "new"
///     compared to the existing model where "new" is defined by
///     mapping to an S-side EntitySet which did not exist under the
///     same name in the existing model
///     Note: it is assumed that no C-side Associations for the temporary
///     DB-based artifact are unmapped (which is true in the CSDL generated
///     by the runtime). If any are unmapped they will appear as "existing".
/// </summary>
Construct the list of those C-side Associations which are "new"
compared to the existing model where "new" is defined by
mapping to an S-side EntitySet which did not exist under the
same name in the existing model
Note: it is assumed that no C-side Associations for the temporary
DB-based artifact are unmapped (which is true in the CSDL generated
by the runtime). If any are unmapped they will appear as "existing".
Construct the list of those C - side Associations which are " new " compared to the existing model where " new " is defined by mapping to an S - side EntitySet which did not exist under the same name in the existing model Note : it is assumed that no C - side Associations for the temporary DB - based artifact are unmapped ( which is true in the CSDL generated by the runtime ) . If any are unmapped they will appear as " existing " .
private void FindNewAssociations(
            Dictionary<EntityType, EntityType> tempArtifactCEntityTypeToNewCEntityTypeInExistingArtifact,
            out HashSet<Association> associationsToBeAdded)
        {
            associationsToBeAdded = new HashSet<Association>();
            if (null == _modelRepresentingDatabase
                || null == _modelRepresentingDatabase.Artifact
                || null == _modelRepresentingDatabase.Artifact.ConceptualModel())
            {
                return;
            }
            foreach (var assoc in _modelRepresentingDatabase.Artifact.ConceptualModel().Associations())
            {
                var assocIdentity =
                    _modelRepresentingDatabase.GetAssociationIdentityForAssociation(assoc);
                Debug.Assert(null != assocIdentity, "Null AssociationIdentity for Association " + assoc.ToPrettyString());
                if (null != assocIdentity)
                {
                    if (_preExistingModel.AssociationSummary.Contains(assocIdentity))
                    {
                        continue;
                    }
                    if (
                        !HasBeenReplacedByInheritanceOrSplitEntity(
                            assoc, assocIdentity, tempArtifactCEntityTypeToNewCEntityTypeInExistingArtifact))
                    {
                        associationsToBeAdded.Add(assoc);
                    }
                }
            }
        }
private void FindNewAssociations ( Dictionary < EntityType , EntityType > tempArtifactCEntityTypeToNewCEntityTypeInExistingArtifact , out HashSet < Association > associationsToBeAdded ) { associationsToBeAdded = new HashSet < Association > ( ) ; if ( null == _modelRepresentingDatabase || null == _modelRepresentingDatabase . Artifact || null == _modelRepresentingDatabase . Artifact . ConceptualModel ( ) ) { return ; } foreach ( var assoc in _modelRepresentingDatabase . Artifact . ConceptualModel ( ) . Associations ( ) ) { var assocIdentity = _modelRepresentingDatabase . GetAssociationIdentityForAssociation ( assoc ) ; Debug . Assert ( null != assocIdentity , " " + assoc . ToPrettyString ( ) ) ; if ( null != assocIdentity ) { if ( _preExistingModel . AssociationSummary . Contains ( assocIdentity ) ) { continue ; } if ( ! HasBeenReplacedByInheritanceOrSplitEntity ( assoc , assocIdentity , tempArtifactCEntityTypeToNewCEntityTypeInExistingArtifact ) ) { associationsToBeAdded . Add ( assoc ) ; } } } }
Construct the list of those C-side Associations which are "new"
compared to the existing model where "new" is defined by
mapping to an S-side EntitySet which did not exist under the
same name in the existing model
Note: it is assumed that no C-side Associations for the temporary
DB-based artifact are unmapped (which is true in the CSDL generated
by the runtime).
Construct the list of those C - side Associations which are " new " compared to the existing model where " new " is defined by mapping to an S - side EntitySet which did not exist under the same name in the existing model Note : it is assumed that no C - side Associations for the temporary DB - based artifact are unmapped ( which is true in the CSDL generated by the runtime ) .
// loop over each Association in the temp model from DB, lookup // its AssociationIdentity (if any) and compare to pre-existing // AssociationIdentities from existing model. Assign the Association to // associationsToBeAdded if pre-existing model contained no matching // identity and if the Association has not been replaced in the existing // model by an inheritance relationship (see below for details) // if identical association already exists then skip // if association has been replaced by an inheritance // relationship then skip, otherwise include 
tempArtifactCEntityTypeToNewCEntityTypeInExistingArtifact
Dictionary<EntityType, EntityType>
HashSet<Association>
out