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(); } } } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context == null || context.Instance == null) { return(value); } var desc = context.Instance as EFAssociationDescriptor; if (desc != null) { var assoc = desc.WrappedItem as Association; if (assoc != null) { var commands = ReferentialConstraintDialog.LaunchReferentialConstraintDialog(assoc); var cpc = new CommandProcessorContext( desc.EditingContext, EfiTransactionOriginator.PropertyWindowOriginatorId, Resources.Tx_ReferentialContraint); var cp = new CommandProcessor(cpc); foreach (var c in commands) { cp.EnqueueCommand(c); } cp.Invoke(); } } return(value); }