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
- WebPartCollection.cs
- SerializeAbsoluteContext.cs
- DataControlCommands.cs
- UniqueIdentifierService.cs
- StubHelpers.cs
- TrustManagerMoreInformation.cs
- OlePropertyStructs.cs
- RegionIterator.cs
- IsolatedStorageFile.cs
- infer.cs
- TextDecoration.cs
- Line.cs
- SolidColorBrush.cs
- InternalEnumValidator.cs
- FunctionQuery.cs
- MaterialCollection.cs
- Queue.cs
- WebChannelFactory.cs
- XmlDigitalSignatureProcessor.cs
- TemplateBindingExpression.cs
- DataRowCollection.cs
- OperationInvokerBehavior.cs
- BaseConfigurationRecord.cs
- MsmqVerifier.cs
- OdbcPermission.cs
- TripleDESCryptoServiceProvider.cs
- CodeCommentStatementCollection.cs
- WindowsRebar.cs
- ToolboxItem.cs
- SynthesizerStateChangedEventArgs.cs
- MimeFormatExtensions.cs
- RootBrowserWindowProxy.cs
- TrustSection.cs
- XmlNodeChangedEventManager.cs
- StringBlob.cs
- SpanIndex.cs
- LambdaCompiler.Statements.cs
- PlanCompilerUtil.cs
- DataExpression.cs
- DataSetUtil.cs
- PipelineModuleStepContainer.cs
- X509ServiceCertificateAuthenticationElement.cs
- PageAsyncTaskManager.cs
- FrameAutomationPeer.cs
- RijndaelManaged.cs
- GridViewItemAutomationPeer.cs
- PreProcessInputEventArgs.cs
- OpCodes.cs
- HttpModulesSection.cs
- SHA256Managed.cs
- TextWriterTraceListener.cs
- PerformanceCountersElement.cs
- StreamAsIStream.cs
- DbDataSourceEnumerator.cs
- ImpersonationContext.cs
- TableLayout.cs
- HierarchicalDataSourceControl.cs
- XmlLinkedNode.cs
- NativeMethods.cs
- DefaultValueConverter.cs
- ReferenceAssemblyAttribute.cs
- ProxyElement.cs
- CLSCompliantAttribute.cs
- DialogWindow.cs
- ExpressionBuilderCollection.cs
- BulletedList.cs
- BulletChrome.cs
- RadioButtonList.cs
- FixedTextPointer.cs
- XamlWrappingReader.cs
- SessionState.cs
- StreamInfo.cs
- XamlTreeBuilderBamlRecordWriter.cs
- RSAOAEPKeyExchangeFormatter.cs
- UnknownWrapper.cs
- DirectoryInfo.cs
- BooleanStorage.cs
- SafeArrayTypeMismatchException.cs
- DataObjectMethodAttribute.cs
- InputQueue.cs
- Tracking.cs
- JournalEntryListConverter.cs
- PathGradientBrush.cs
- FragmentQuery.cs
- MenuCommands.cs
- PolicyLevel.cs
- COM2ExtendedUITypeEditor.cs
- SQLBytesStorage.cs
- OleDbReferenceCollection.cs
- TextTreeInsertUndoUnit.cs
- SystemWebSectionGroup.cs
- JsonEncodingStreamWrapper.cs
- PrinterResolution.cs
- ArgumentsParser.cs
- SamlSubject.cs
- CodeTypeOfExpression.cs
- AssociationSetEnd.cs
- Executor.cs
- ExpressionPrefixAttribute.cs
- TextTreeUndo.cs