src/Misc/EFTools/EntityDesignEntityDesigner/CustomCode/DomainClasses/EntityDesignerViewModel.cs
/// <summary>
///     Return true if processing this change caused a reload of the entire doc, false otherwise.
/// </summary>
Return true if processing this change caused a reload of the entire doc, false otherwise.
Return true if processing this change caused a reload of the entire doc false otherwise .
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
        private bool ProcessSingleModelChange(EfiChange change)
        {
            var xref = ModelXRef;
            if ((change.Type == EfiChange.EfiChangeType.Create ||
                 change.Type == EfiChange.EfiChangeType.Delete)
                && (change.Changed is EFArtifact ||
                 change.Changed is ConceptualEntityModel))
            {
                ClearAndReloadDiagram();
                return true;
            }
            else
            {
                try
                {
                    switch (change.Type)
                    {
                        case EfiChange.EfiChangeType.Update:
                            OnEFObjectUpdated(change, xref);
                            break;
                        case EfiChange.EfiChangeType.Create:
                            if (!(change.Changed is Model.Entity.Association
                                  || change.Changed is ConceptualEntityType
                                  || change.Changed is EntityTypeBaseType))
                            {
                                OnEFObjectUpdated(change, xref);
                            }
                            break;
                        case EfiChange.EfiChangeType.Delete:
                            OnEFObjectDeleted(change.Changed, xref);
                            break;
                        default:
                            Debug.Assert(false, "Unknown change type.");
                            break;
                    }
                    var baseType = change.Changed as EntityTypeBaseType;
                    if (baseType != null)
                    {
                        Debug.Assert(baseType.Parent != null, "EntityTypeBaseType's Parent should not be null.");
                        if (baseType.Parent != null)
                        {
                            var entityType = ModelXRef.GetExisting(baseType.Parent) as EntityType;
                            if (entityType != null)
                            {
                                var ets = PresentationViewsSubject.GetPresentation(entityType).FirstOrDefault() as EntityTypeShape;
                                Debug.Assert(ets != null, "The shape for entity-type : " + entityType.Name + " is not available.");
                                if (ets != null)
                                {
                                    ets.Invalidate();
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.Fail("Exception caught while processing changes to the designer", e.Message);
                    ClearAndReloadDiagram();
                    return true;
                }
            }
            return false;
        }
[ SuppressMessage ( " " , " " ) ] private bool ProcessSingleModelChange ( EfiChange change ) { var xref = ModelXRef ; if ( ( change . Type == EfiChange . EfiChangeType . Create || change . Type == EfiChange . EfiChangeType . Delete ) && ( change . Changed is EFArtifact || change . Changed is ConceptualEntityModel ) ) { ClearAndReloadDiagram ( ) ; return true ; } else { try { switch ( change . Type ) { case EfiChange . EfiChangeType . Update : OnEFObjectUpdated ( change , xref ) ; break ; case EfiChange . EfiChangeType . Create : if ( ! ( change . Changed is Model . Entity . Association || change . Changed is ConceptualEntityType || change . Changed is EntityTypeBaseType ) ) { OnEFObjectUpdated ( change , xref ) ; } break ; case EfiChange . EfiChangeType . Delete : OnEFObjectDeleted ( change . Changed , xref ) ; break ; default : Debug . Assert ( false , " " ) ; break ; } var baseType = change . Changed as EntityTypeBaseType ; if ( baseType != null ) { Debug . Assert ( baseType . Parent != null , " " ) ; if ( baseType . Parent != null ) { var entityType = ModelXRef . GetExisting ( baseType . Parent ) as EntityType ; if ( entityType != null ) { var ets = PresentationViewsSubject . GetPresentation ( entityType ) . FirstOrDefault ( ) as EntityTypeShape ; Debug . Assert ( ets != null , " " + entityType . Name + " " ) ; if ( ets != null ) { ets . Invalidate ( ) ; } } } } } catch ( Exception e ) { Debug . Fail ( " " , e . Message ) ; ClearAndReloadDiagram ( ) ; return true ; } } return false ; }
Return true if processing this change caused a reload of the entire doc, false otherwise.
Return true if processing this change caused a reload of the entire doc false otherwise .
// the artifact or model has changed on us, reload the whole thing // Adding association, entity-type or inheritance is no longer translate to the addition of the corresponding DSL model elements. // We only add the DSL model elements if Escher model diagrams are added (InheritanceConnector etc.) // If Entity-type's base type has changed, invalidate the shape so the base type name in the shape can be updated. // the entity type is null if it is not in the diagram.
change
EfiChange