protected string ComputeReceivePortName(IReceivePort <TNamingConvention> receivePort) { if (receivePort.ApplicationBinding == null) { throw new NamingConventionException( string.Format( "'{0}' ReceivePort is not bound to application's receive port collection.", receivePort.GetType().Name)); } if (Equals(Party, default(TParty))) { throw new NamingConventionException( string.Format( "'{0}' ReceivePort's Party is required.", receivePort.GetType().Name)); } var area = ComputeArea(receivePort.GetType()); return(string.Format( "{0}{1}.RP{2}.{3}", ((ISupportNamingConvention)receivePort.ApplicationBinding).Name, area.IsNullOrEmpty() ? string.Empty : string.Format(".{0}", area), receivePort.IsTwoWay ? "2" : "1", Party)); }
protected string ComputeReceivePortName(IReceivePort <TNamingConvention> receivePort) { if (receivePort == null) { throw new ArgumentNullException(nameof(receivePort)); } if (receivePort.ApplicationBinding == null) { throw new NamingConventionException($"'{receivePort.GetType().Name}' ReceivePort is not bound to application's receive port collection."); } if (Equals(Party, default(TParty))) { throw new NamingConventionException($"'{receivePort.GetType().Name}' ReceivePort's Party is required."); } var aggregate = ComputeAggregateName(receivePort.GetType()); return(string.Format( CultureInfo.InvariantCulture, "{0}{1}.RP{2}.{3}", receivePort.ApplicationBinding.ResolveName(), aggregate.IsNullOrEmpty() ? string.Empty : $".{aggregate}", receivePort.IsTwoWay ? "2" : "1", Party)); }
public void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { var name = ((ISupportNamingConvention)receivePort).Name; _receivePort = _application.ReceivePorts[name]; }
public void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { if (receivePort == null) { throw new ArgumentNullException(nameof(receivePort)); } ((ISupportValidation)receivePort).Validate(); }
public void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { if (receivePort == null) { throw new ArgumentNullException(nameof(receivePort)); } ((ISupportEnvironmentOverride)receivePort).ApplyEnvironmentOverrides(Environment); }
internal static string ComputeReceivePortName <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { return(ComputeName( receivePort, "Receive Port", convention => convention.ComputeReceivePortName(receivePort))); }
protected internal override void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { _lastVisitedReceivePort = CreateReceivePort(receivePort); if (BindingInfo.ReceivePortCollection.Find(_lastVisitedReceivePort.Name) != null) { throw new BindingException($"Duplicate receive port name: '{_lastVisitedReceivePort.Name}'."); } BindingInfo.ReceivePortCollection.Add(_lastVisitedReceivePort); }
public void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { // skip ReceivePort not belonging to this application if (!ReferenceEquals(receivePort.ApplicationBinding, _applicationBinding)) { return; } _decoratedVisitor.VisitReceivePort(receivePort); }
void IApplicationBindingVisitor.VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { if (receivePort == null) { throw new ArgumentNullException(nameof(receivePort)); } // visit only ReceivePort belonging to this application if (ReferenceEquals(receivePort.ApplicationBinding, _mainApplicationBinding)) { VisitReceivePort(receivePort); } }
public void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { _lastVisitedReceivePort = CreateReceivePort(receivePort); if (BindingInfo.ReceivePortCollection.Find(_lastVisitedReceivePort.Name) != null) { throw new InvalidOperationException( string.Format( "Duplicate receive port name: '{0}'.", _lastVisitedReceivePort.Name)); } BindingInfo.ReceivePortCollection.Add(_lastVisitedReceivePort); }
public void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { }
string INamingConvention <NamingConvention <TParty, TSubject> > .ComputeReceivePortName(IReceivePort <NamingConvention <TParty, TSubject> > receivePort) { return(base.ComputeReceivePortName(receivePort)); }
protected internal virtual BtsReceivePort CreateReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { ((ISupportValidation)receivePort).Validate(); var port = new BtsReceivePort { ApplicationName = ApplicationName, // TODO Authentication = // TODO BindingOption = Description = receivePort.Description, IsTwoWay = receivePort.IsTwoWay, Name = ((ISupportNamingConvention)receivePort).Name, // TODO OutboundTransforms = ReceiveLocations = new Microsoft.BizTalk.Deployment.Binding.ReceiveLocationCollection() // TODO RouteFailedMessage = // TODO SendPipelineData = // TODO Tracking = // TODO Transforms = // TODO TransmitPipeline = }; return(port); }
string INamingConvention <NamingConventionSpy> .ComputeReceivePortName(IReceivePort <NamingConventionSpy> receivePort) { throw new NotSupportedException(); }
/// <summary> /// Creates receive port with one request-response HTTP receive location /// </summary> /// <param name="virtualDirectory">Virtual directory name</param> /// <param name="portName">Receive port name</param> /// <param name="locationName">Receive location name</param> /// <returns>True if successful, otherwise false</returns> public static bool CreateHttpRequestResponsePort(string virtualDirectory, string portName, string locationName, ref string retMsg) { IBtsCatalogExplorer explorer = null; try { string mgmtDBName = "BizTalkMgmtDb"; string mgmtDBServer = "localhost"; ManagementClass groupSettings = new ManagementClass("root\\MicrosoftBizTalkServer:MSBTS_GroupSetting"); foreach (ManagementObject obj in groupSettings.GetInstances()) { mgmtDBName = (string)obj.Properties["MgmtDbName"].Value; mgmtDBServer = (string)obj.Properties["MgmtDbServerName"].Value; } // Get BizTalk Explorer object explorer = new BtsCatalogExplorer(); explorer.ConnectionString = "SERVER=" + mgmtDBServer + ";DATABASE=" + mgmtDBName + ";Integrated Security=SSPI"; // Delete this port if it already exists foreach (IReceivePort port in explorer.GetCollection(CollectionType.ReceivePort)) { if (port.Name.ToLower() == portName.ToLower()) { explorer.RemoveReceivePort(port); break; } } explorer.SaveChanges(); // Add new port IReceivePort receivePort = explorer.AddNewReceivePort(true); receivePort.Name = portName; // Add new location IReceiveLocation rxLocation = receivePort.AddNewReceiveLocation(); rxLocation.Name = locationName; // Set the receive location rxLocation.Address = "/" + virtualDirectory + "/BTSHttpReceive.dll"; // Set the transport type foreach (IProtocolType protocol in explorer.GetCollection(CollectionType.ProtocolType)) { if (protocol.Name == "HTTP") { rxLocation.TransportType = protocol; } } // Set the transport data rxLocation.TransportTypeData = "<CustomProps>" + "<Address vt=\"8\">" + rxLocation.Address + "</Address>" + "<LoopBack vt=\"11\">0</LoopBack>" + "<IsSynchronous vt=\"11\">1</IsSynchronous>" + "<ReturnCorrelationHandle vt=\"11\">0</ReturnCorrelationHandle>" + "<ResponseContentType vt=\"8\">text/html</ResponseContentType>" + "<URI vt=\"8\">" + rxLocation.Address + "</URI>" + "<UseSSO vt=\"11\">1</UseSSO>" + "</CustomProps>"; // Set the receive pipeline foreach (IPipeline pipe in explorer.GetCollection(CollectionType.Pipeline)) { if ((pipe.Type == PipelineType.Receive) && (pipe.FullName == "Microsoft.BizTalk.DefaultPipelines.PassThruReceive")) { rxLocation.ReceivePipeline = pipe; break; } } // Set the receive handler foreach (IReceiveHandler handler in explorer.GetCollection(CollectionType.ReceiveHandler)) { if (handler.TransportType == rxLocation.TransportType) { rxLocation.ReceiveHandler = handler; break; } } foreach (IPipeline pipe in explorer.GetCollection(CollectionType.Pipeline)) { if ((pipe.Type == PipelineType.Send) && (pipe.FullName == "Microsoft.BizTalk.DefaultPipelines.PassThruTransmit")) { receivePort.SendPipeline = pipe; break; } } // Enable this receive location rxLocation.Enable = true; // Save changes explorer.SaveChanges(); } catch (Exception e) { retMsg = e.Message.ToString(); if (explorer != null) { explorer.DiscardChanges(); } return(false); } return(true); }
string INamingConvention <NamingConventionDouble> .ComputeReceivePortName(IReceivePort <NamingConventionDouble> receivePort) { throw new NotImplementedException(); }
IReceivePortCollection <TNamingConvention> IReceivePortCollection <TNamingConvention> .Add(IReceivePort <TNamingConvention> receivePort) { return(((IReceivePortCollection <TNamingConvention>) this).Add(new[] { receivePort })); }
public string ComputeReceivePortNameSpy(IReceivePort <NamingConventionDouble> receivePort) { return(ComputeReceivePortName(receivePort)); }
public void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class { ((ISupportEnvironmentOverride)receivePort).ApplyEnvironmentOverrides(Environment); ((ISupportValidation)receivePort).Validate(); }
internal ReceiveLocationCollection(IReceivePort <TNamingConvention> receivePort) { _receivePort = receivePort; }
protected internal abstract void VisitReceivePort <TNamingConvention>(IReceivePort <TNamingConvention> receivePort) where TNamingConvention : class;
string INamingConvention <NamingConvention> .ComputeReceivePortName(IReceivePort <NamingConvention> receivePort) { return(base.ComputeReceivePortName(receivePort)); }