src/Misc/EFTools/EntityDesignEntityDesigner/CustomCode/SerializationHelper/MicrosoftDataEntityDesignSerializationHelper.cs
/// <summary>
///     This method reads the .diagram file and makes sure that shapes exist for every item
///     in the .diagram file.
/// </summary>
This method reads the .diagram file and makes sure that shapes exist for every item
in the .diagram file.
This method reads the . diagram file and makes sure that shapes exist for every item in the . diagram file .
internal static void ReloadDiagram(EntityDesignerViewModel viewModel)
        {
            var diagram = viewModel.GetDiagram();
            if (diagram == null)
            {
                return;
            }
            diagram.ResetWatermark(diagram.ActiveDiagramView);
            var artifact = EditingContextManager.GetArtifact(viewModel.EditingContext);
            Debug.Assert(artifact != null);
            if (!artifact.IsDesignerSafe)
            {
                return;
            }
            var diagramModel = viewModel.ModelXRef.GetExisting(diagram) as DesignerModel.Diagram;
            if (diagramModel != null)
            {
                EntityModelToDslModelTranslatorStrategy.TranslateDiagram(diagram, diagramModel);
            }
            else
            {
                if (diagram.ModelElement.EntityTypes.Count < EntityDesignerDiagram.IMPLICIT_AUTO_LAYOUT_CEILING)
                {
                    diagram.AutoLayoutDiagram();
                }
                EntityModelToDslModelTranslatorStrategy.CreateDefaultDiagram(viewModel.EditingContext, diagram);
            }
            if (diagram.ActiveDiagramView != null)
            {
                diagram.ActiveDiagramView.Selection.Set(new DiagramItem(diagram));
            }
        }
internal static void ReloadDiagram ( EntityDesignerViewModel viewModel ) { var diagram = viewModel . GetDiagram ( ) ; if ( diagram == null ) { return ; } diagram . ResetWatermark ( diagram . ActiveDiagramView ) ; var artifact = EditingContextManager . GetArtifact ( viewModel . EditingContext ) ; Debug . Assert ( artifact != null ) ; if ( ! artifact . IsDesignerSafe ) { return ; } var diagramModel = viewModel . ModelXRef . GetExisting ( diagram ) as DesignerModel . Diagram ; if ( diagramModel != null ) { EntityModelToDslModelTranslatorStrategy . TranslateDiagram ( diagram , diagramModel ) ; } else { if ( diagram . ModelElement . EntityTypes . Count < EntityDesignerDiagram . IMPLICIT_AUTO_LAYOUT_CEILING ) { diagram . AutoLayoutDiagram ( ) ; } EntityModelToDslModelTranslatorStrategy . CreateDefaultDiagram ( viewModel . EditingContext , diagram ) ; } if ( diagram . ActiveDiagramView != null ) { diagram . ActiveDiagramView . Selection . Set ( new DiagramItem ( diagram ) ) ; } }
This method reads the .diagram file and makes sure that shapes exist for every item
in the .diagram file.
This method reads the . diagram file and makes sure that shapes exist for every item in the . diagram file .
// Empty DSL diagram // get our artifact // ensure that we still have all of the parts we need to re-translate from the Model // this path will usually only happen if an UMFDB extension has deleted the diagram node // since we don't have a diagram anymore, lay it all out and create a new one // remove "Select All" selection
viewModel
EntityDesignerViewModel