public override void OnDoubleClick(DiagramPointEventArgs e) { var association = ModelElement; if (association != null) { var diagram = Diagram as EntityDesignerDiagram; if (diagram != null) { var ec = diagram.GetModel().EditingContext; var xref = ModelToDesignerModelXRef.GetModelToDesignerModelXRef(ec); var modelAssociation = xref.GetExisting(association) as Model.Entity.Association; Debug.Assert(modelAssociation != null, "couldn't find model association for connector"); if (modelAssociation != null) { var commands = ReferentialConstraintDialog.LaunchReferentialConstraintDialog(modelAssociation); var cpc = new CommandProcessorContext( ec, EfiTransactionOriginator.EntityDesignerOriginatorId, Resources.Tx_ReferentialContraint); var cp = new CommandProcessor(cpc); foreach (var c in commands) { cp.EnqueueCommand(c); } cp.Invoke(); } } } }
internal static bool IsUniqueName(ModelElement elementToCheck, string proposedName, EditingContext context) { if (string.IsNullOrEmpty(proposedName) || elementToCheck == null) { return(false); } var xref = ModelToDesignerModelXRef.GetModelToDesignerModelXRef(context); var modelItem = xref.GetExisting(elementToCheck); if (modelItem != null) { string msg; return(EDMModelHelper.IsUniqueNameForExistingItem(modelItem, proposedName, true, out msg)); } return(true); }