Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / MsmqTransportBindingElement.cs / 1 / MsmqTransportBindingElement.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Channels { using System.ServiceModel.Activation; using System.Collections.Generic; using System.Net.Security; using System.Runtime.Serialization; using System.ServiceModel.Security; using System.Xml; public sealed class MsmqTransportBindingElement : MsmqBindingElementBase { int maxPoolSize = MsmqDefaults.MaxPoolSize; bool useActiveDirectory = MsmqDefaults.UseActiveDirectory; QueueTransferProtocol queueTransferProtocol = MsmqDefaults.QueueTransferProtocol; public MsmqTransportBindingElement() { } MsmqTransportBindingElement(MsmqTransportBindingElement elementToBeCloned) : base(elementToBeCloned) { this.useActiveDirectory = elementToBeCloned.useActiveDirectory; this.maxPoolSize = elementToBeCloned.maxPoolSize; this.queueTransferProtocol = elementToBeCloned.queueTransferProtocol; } internal override MsmqUri.IAddressTranslator AddressTranslator { get { switch (this.queueTransferProtocol) { case QueueTransferProtocol.Srmp: return MsmqUri.SrmpAddressTranslator; case QueueTransferProtocol.SrmpSecure: return MsmqUri.SrmpsAddressTranslator; default: return this.useActiveDirectory ? MsmqUri.ActiveDirectoryAddressTranslator : MsmqUri.NetMsmqAddressTranslator; } } } public int MaxPoolSize { get { return this.maxPoolSize; } set { if (value < 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("value", value, SR.GetString(SR.MsmqNonNegativeArgumentExpected))); } this.maxPoolSize = value; } } public QueueTransferProtocol QueueTransferProtocol { get { return this.queueTransferProtocol; } set { if (! QueueTransferProtocolHelper.IsDefined(value)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value")); this.queueTransferProtocol = value; } } public override string Scheme { get { return "net.msmq"; } } public bool UseActiveDirectory { get { return this.useActiveDirectory; } set { this.useActiveDirectory = value; } } internal override string WsdlTransportUri { get { return TransportPolicyConstants.MsmqTransportUri; } } public override BindingElement Clone() { return new MsmqTransportBindingElement(this); } public override bool CanBuildChannelFactory(BindingContext context) { return (typeof(TChannel) == typeof(IOutputChannel) || typeof(TChannel) == typeof(IOutputSessionChannel)); } public override bool CanBuildChannelListener (BindingContext context) { return (typeof(TChannel) == typeof(IInputChannel) || typeof(TChannel) == typeof(IInputSessionChannel)); } public override IChannelFactory BuildChannelFactory (BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if (typeof(TChannel) == typeof(IOutputChannel)) { MsmqChannelFactoryBase factory = new MsmqOutputChannelFactory(this, context); MsmqVerifier.VerifySender (factory); return (IChannelFactory )(object)factory; } else if (typeof(TChannel) == typeof(IOutputSessionChannel)) { MsmqChannelFactoryBase factory = new MsmqOutputSessionChannelFactory(this, context); MsmqVerifier.VerifySender (factory); return (IChannelFactory )(object)factory; } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel))); } } public override IChannelListener BuildChannelListener (BindingContext context) { if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } TransportChannelListener msmqListener; MsmqTransportReceiveParameters receiveParameters = new MsmqTransportReceiveParameters(this, MsmqUri.NetMsmqAddressTranslator); if (typeof(TChannel) == typeof(IInputChannel)) { msmqListener = new MsmqInputChannelListener(this, context, receiveParameters); } else if (typeof(TChannel) == typeof(IInputSessionChannel)) { msmqListener = new MsmqInputSessionChannelListener(this, context, receiveParameters); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel))); } VirtualPathExtension.ApplyHostedContext(msmqListener, context); MsmqVerifier.VerifyReceiver(receiveParameters, msmqListener.Uri); return (IChannelListener )(object)msmqListener; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FormViewPagerRow.cs
- VersionPair.cs
- ViewStateException.cs
- ButtonBase.cs
- AlternateViewCollection.cs
- InteropBitmapSource.cs
- RegistrationServices.cs
- WindowsListViewScroll.cs
- WriteTimeStream.cs
- FullTrustAssemblyCollection.cs
- RectangleGeometry.cs
- TabControlAutomationPeer.cs
- DomainUpDown.cs
- ListenerUnsafeNativeMethods.cs
- BufferedMessageWriter.cs
- SizeAnimationClockResource.cs
- TextServicesCompartment.cs
- BaseInfoTable.cs
- OracleBoolean.cs
- Int32Storage.cs
- DesignerToolStripControlHost.cs
- ToggleProviderWrapper.cs
- _ProxyChain.cs
- XmlNodeChangedEventArgs.cs
- OleAutBinder.cs
- Activity.cs
- TextProviderWrapper.cs
- DataSourceView.cs
- AlignmentXValidation.cs
- PeerCredential.cs
- sqlcontext.cs
- SortedList.cs
- EdmPropertyAttribute.cs
- AsyncResult.cs
- XmlSchemas.cs
- XmlSignatureManifest.cs
- cookieexception.cs
- CollectionViewSource.cs
- InputMethodStateTypeInfo.cs
- DashStyles.cs
- HasActivatableWorkflowEvent.cs
- httpstaticobjectscollection.cs
- DateTimeFormat.cs
- SubqueryRules.cs
- MD5.cs
- BaseTreeIterator.cs
- followingquery.cs
- BamlMapTable.cs
- ResourcesGenerator.cs
- CollectionCodeDomSerializer.cs
- RequestUriProcessor.cs
- DateBoldEvent.cs
- HMAC.cs
- TypedReference.cs
- DodSequenceMerge.cs
- XmlSchemaSubstitutionGroup.cs
- CodeDirectoryCompiler.cs
- InputQueueChannelAcceptor.cs
- TextBox.cs
- XmlSerializer.cs
- BasicHttpSecurity.cs
- CodeConditionStatement.cs
- ErrorHandler.cs
- FrameworkElementFactoryMarkupObject.cs
- XmlNamespaceMapping.cs
- MediaElement.cs
- SafeRightsManagementPubHandle.cs
- _AutoWebProxyScriptEngine.cs
- WindowsScrollBar.cs
- XamlFilter.cs
- PathTooLongException.cs
- AlignmentYValidation.cs
- oledbmetadatacolumnnames.cs
- ConsoleKeyInfo.cs
- Attributes.cs
- ValidationHelper.cs
- ClientSettingsProvider.cs
- ContentDesigner.cs
- Asn1Utilities.cs
- COM2IProvidePropertyBuilderHandler.cs
- SerializableAttribute.cs
- WebBaseEventKeyComparer.cs
- AssemblyUtil.cs
- BorderSidesEditor.cs
- XamlToRtfWriter.cs
- PropertyDescriptorComparer.cs
- DataGridItem.cs
- CapabilitiesAssignment.cs
- WindowsSspiNegotiation.cs
- DataGridColumnCollection.cs
- PixelFormatConverter.cs
- ComponentResourceManager.cs
- DiscoveryClientDocuments.cs
- EnumerableCollectionView.cs
- SafeRightsManagementQueryHandle.cs
- CellQuery.cs
- TemplateBamlTreeBuilder.cs
- ExceptionAggregator.cs
- SqlStatistics.cs
- PngBitmapDecoder.cs