src/Misc/EFTools/EntityDesignModel/Commands/CreateDiagramCommand.cs
/// <summary>
///     This helper function will create a Diagram using default name.
///     NOTE: If the cpc already has an active transaction, these changes will be in that transaction
///     and the caller of this helper method must commit it to see these changes commited
///     otherwise the diagram will never be created.
/// </summary>
/// <param name="cpc"></param>
/// <returns>The new ComplexType</returns>
This helper function will create a Diagram using default name.
NOTE: If the cpc already has an active transaction, these changes will be in that transaction
and the caller of this helper method must commit it to see these changes commited
otherwise the diagram will never be created.
This helper function will create a Diagram using default name . NOTE : If the cpc already has an active transaction these changes will be in that transaction and the caller of this helper method must commit it to see these changes commited otherwise the diagram will never be created .
internal static Diagram CreateDiagramWithDefaultName(CommandProcessorContext cpc)
        {
            Debug.Assert(cpc != null, "The passed in CommandProcessorContext is null.");
            if (cpc != null)
            {
                var service = cpc.EditingContext.GetEFArtifactService();
                var entityDesignArtifact = service.Artifact as EntityDesignArtifact;
                if (entityDesignArtifact == null
                    || entityDesignArtifact.DesignerInfo == null
                    || entityDesignArtifact.DesignerInfo.Diagrams == null)
                {
                    throw new CannotLocateParentItemException();
                }
                var diagramName = ModelHelper.GetUniqueNameWithNumber(
                    typeof(Diagram), entityDesignArtifact.DesignerInfo.Diagrams, Resources.Model_DefaultDiagramName);
                var cp = new CommandProcessor(cpc);
                var cmd = new CreateDiagramCommand(diagramName, entityDesignArtifact.DesignerInfo.Diagrams);
                cp.EnqueueCommand(cmd);
                cp.Invoke();
                return cmd.Diagram;
            }
            return null;
        }
internal static Diagram CreateDiagramWithDefaultName ( CommandProcessorContext cpc ) { Debug . Assert ( cpc != null , " " ) ; if ( cpc != null ) { var service = cpc . EditingContext . GetEFArtifactService ( ) ; var entityDesignArtifact = service . Artifact as EntityDesignArtifact ; if ( entityDesignArtifact == null || entityDesignArtifact . DesignerInfo == null || entityDesignArtifact . DesignerInfo . Diagrams == null ) { throw new CannotLocateParentItemException ( ) ; } var diagramName = ModelHelper . GetUniqueNameWithNumber ( typeof ( Diagram ) , entityDesignArtifact . DesignerInfo . Diagrams , Resources . Model_DefaultDiagramName ) ; var cp = new CommandProcessor ( cpc ) ; var cmd = new CreateDiagramCommand ( diagramName , entityDesignArtifact . DesignerInfo . Diagrams ) ; cp . EnqueueCommand ( cmd ) ; cp . Invoke ( ) ; return cmd . Diagram ; } return null ; }
This helper function will create a Diagram using default name.
This helper function will create a Diagram using default name .
// go create it
The new ComplexType
The new ComplexType
cpc
CommandProcessorContext
None