public static DslModeling::ElementLink Connect(DslModeling::ModelElement source, DslModeling::ModelElement target) { if (source == null) { throw new global::System.ArgumentNullException("source"); } if (target == null) { throw new global::System.ArgumentNullException("target"); } if (CanAcceptSourceAndTarget(source, target)) { if (source is global::BizTalkMessaging.OutPort) { if (target is global::BizTalkMessaging.Application) { global::BizTalkMessaging.OutPort sourceAccepted = (global::BizTalkMessaging.OutPort)source; global::BizTalkMessaging.Application targetAccepted = (global::BizTalkMessaging.Application)target; DslModeling::ElementLink result = new global::BizTalkMessaging.OutPortSendsToApplication(sourceAccepted, targetAccepted); if (DslModeling::DomainClassInfo.HasNameProperty(result)) { DslModeling::DomainClassInfo.SetUniqueName(result); } return(result); } } } global::System.Diagnostics.Debug.Fail("Having agreed that the connection can be accepted we should never fail to make one."); throw new global::System.InvalidOperationException(); }
/// <summary> /// Called by the Merge process to create a relationship between /// this target element and the specified source element. /// Typically, a parent-child relationship is established /// between the target element (the parent) and the source element /// (the child), but any relationship can be established. /// </summary> /// <param name="sourceElement">The element that is to be related to this model element.</param> /// <param name="elementGroup">The group of source ModelElements that have been rehydrated into the target store.</param> /// <remarks> /// This method is overriden to create the relationship between the target element and the specified source element. /// The base method does nothing. /// </remarks> protected override void MergeRelate(DslModeling::ModelElement sourceElement, DslModeling::ElementGroup elementGroup) { // In general, sourceElement is allowed to be null, meaning that the elementGroup must be parsed for special cases. // However this is not supported in generated code. Use double-deriving on this class and then override MergeRelate completely if you // need to support this case. if (sourceElement == null) { throw new global::System.ArgumentNullException("sourceElement"); } global::BizTalkMessaging.Broker sourceBroker1 = sourceElement as global::BizTalkMessaging.Broker; if (sourceBroker1 != null) { // Create link for path BizTalkMessagingModelHasBroker.Broker this.Broker = sourceBroker1; return; } global::BizTalkMessaging.Application sourceApplication2 = sourceElement as global::BizTalkMessaging.Application; if (sourceApplication2 != null) { // Create link for path BizTalkMessagingModelHasApplications.Applications this.Applications.Add(sourceApplication2); return; } // Fall through to base class if this class hasn't handled the merge. base.MergeRelate(sourceElement, elementGroup); }
public static bool CanAcceptSourceAndTarget(DslModeling::ModelElement candidateSource, DslModeling::ModelElement candidateTarget) { // Accepts null, null; source, null; source, target but NOT null, target if (candidateSource == null) { if (candidateTarget != null) { throw new global::System.ArgumentNullException("candidateSource"); } else // Both null { return(false); } } bool acceptSource = CanAcceptSource(candidateSource); // If the source wasn't accepted then there's no point checking targets. // If there is no target then the source controls the accept. if (!acceptSource || candidateTarget == null) { return(acceptSource); } else // Check combinations { if (candidateSource is global::BizTalkMessaging.Application) { if (candidateTarget is global::BizTalkMessaging.InPort) { global::BizTalkMessaging.Application sourceApplication = (global::BizTalkMessaging.Application)candidateSource; global::BizTalkMessaging.InPort targetInPort = (global::BizTalkMessaging.InPort)candidateTarget; if (targetInPort == null || global::BizTalkMessaging.ApplicationSendsToInPort.GetLinkToApplication(targetInPort) != null) { return(false); } if (sourceApplication == null || global::BizTalkMessaging.ApplicationSendsToInPort.GetLinkToInPort(sourceApplication) != null) { return(false); } if (targetInPort == null || sourceApplication == null || global::BizTalkMessaging.ApplicationSendsToInPort.GetLinks(sourceApplication, targetInPort).Count > 0) { return(false); } return(true); } } } return(false); }
protected override void MergeDisconnect(DslModeling::ModelElement sourceElement) { if (sourceElement == null) { throw new global::System.ArgumentNullException("sourceElement"); } global::BizTalkMessaging.Broker sourceBroker1 = sourceElement as global::BizTalkMessaging.Broker; if (sourceBroker1 != null) { // Delete link for path BizTalkMessagingModelHasBroker.Broker foreach (DslModeling::ElementLink link in global::BizTalkMessaging.BizTalkMessagingModelHasBroker.GetLinks((global::BizTalkMessaging.BizTalkMessagingModel) this, sourceBroker1)) { // Delete the link, but without possible delete propagation to the element since it's moving to a new location. link.Delete(global::BizTalkMessaging.BizTalkMessagingModelHasBroker.BizTalkMessagingModelDomainRoleId, global::BizTalkMessaging.BizTalkMessagingModelHasBroker.BrokerDomainRoleId); } return; } global::BizTalkMessaging.Application sourceApplication2 = sourceElement as global::BizTalkMessaging.Application; if (sourceApplication2 != null) { // Delete link for path BizTalkMessagingModelHasApplications.Applications foreach (DslModeling::ElementLink link in global::BizTalkMessaging.BizTalkMessagingModelHasApplications.GetLinks((global::BizTalkMessaging.BizTalkMessagingModel) this, sourceApplication2)) { // Delete the link, but without possible delete propagation to the element since it's moving to a new location. link.Delete(global::BizTalkMessaging.BizTalkMessagingModelHasApplications.BizTalkMessagingModelDomainRoleId, global::BizTalkMessaging.BizTalkMessagingModelHasApplications.ElementDomainRoleId); } return; } // Fall through to base class if this class hasn't handled the unmerge. base.MergeDisconnect(sourceElement); }
public static global::BizTalkMessaging.BizTalkMessagingModel GetParentForApplication(global::BizTalkMessaging.Application root) { // Segments 0 and 1 global::BizTalkMessaging.BizTalkMessagingModel result = root.BizTalkMessagingModel; if (result == null) { return(null); } return(result); }