Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / MsmqIntegration / MsmqIntegrationBindingElement.cs / 1 / MsmqIntegrationBindingElement.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel.MsmqIntegration
{
using System.Net.Security;
using System.Runtime.Serialization;
using System.ServiceModel.Channels;
using System.Collections.Generic;
public sealed class MsmqIntegrationBindingElement : MsmqBindingElementBase
{
MsmqMessageSerializationFormat serializationFormat;
Type[] targetSerializationTypes;
public MsmqIntegrationBindingElement()
{
this.serializationFormat = MsmqIntegrationDefaults.SerializationFormat;
}
MsmqIntegrationBindingElement(MsmqIntegrationBindingElement other) : base(other)
{
this.serializationFormat = other.serializationFormat;
if (other.targetSerializationTypes != null)
{
this.targetSerializationTypes = other.targetSerializationTypes.Clone() as Type[];
}
}
public override string Scheme { get { return "msmq.formatname"; } }
internal override MsmqUri.IAddressTranslator AddressTranslator
{
get
{
return MsmqUri.FormatNameAddressTranslator;
}
}
// applicable on: client, server
public MsmqMessageSerializationFormat SerializationFormat
{
get { return this.serializationFormat; }
set
{
if (!MsmqMessageSerializationFormatHelper.IsDefined(value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
}
this.serializationFormat = value;
}
}
// applicable on: receiver
public Type[] TargetSerializationTypes
{
get
{
if (null == this.targetSerializationTypes)
return null;
else
return this.targetSerializationTypes.Clone() as Type[];
}
set
{
if (null == value)
this.targetSerializationTypes = null;
else
this.targetSerializationTypes = value.Clone() as Type[];
}
}
public override BindingElement Clone()
{
return new MsmqIntegrationBindingElement(this);
}
public override bool CanBuildChannelFactory(BindingContext context)
{
return typeof(TChannel) == typeof(IOutputChannel);
}
public override bool CanBuildChannelListener(BindingContext context)
{
return typeof(TChannel) == typeof(IInputChannel);
}
public override IChannelFactory BuildChannelFactory(BindingContext context)
{
if (context == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
}
if (typeof(TChannel) != typeof(IOutputChannel))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
}
MsmqChannelFactoryBase factory = new MsmqIntegrationChannelFactory(this, context);
MsmqVerifier.VerifySender(factory);
return (IChannelFactory)(object)factory;
}
public override IChannelListener BuildChannelListener(BindingContext context)
{
if (context == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
}
if (typeof(TChannel) != typeof(IInputChannel))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("TChannel", SR.GetString(SR.ChannelTypeNotSupported, typeof(TChannel)));
}
MsmqIntegrationReceiveParameters receiveParameters = new MsmqIntegrationReceiveParameters(this);
MsmqIntegrationChannelListener listener = new MsmqIntegrationChannelListener(this, context, receiveParameters);
MsmqVerifier.VerifyReceiver(receiveParameters, listener.Uri);
return (IChannelListener)(object)listener;
}
public override T GetProperty(BindingContext context)
{
if (context == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
}
if (typeof(T) == typeof(MessageVersion))
{
return (T)(object)(MessageVersion.None);
}
else
{
return base.GetProperty(context);
}
}
}
}
// 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
- PixelFormatConverter.cs
- MD5.cs
- TemplateControlBuildProvider.cs
- DialogResultConverter.cs
- ImpersonateTokenRef.cs
- CompositeFontParser.cs
- DiscoveryClientDuplexChannel.cs
- Errors.cs
- PropertyChangedEventArgs.cs
- ClientSponsor.cs
- WebBrowserUriTypeConverter.cs
- Operand.cs
- DataGridColumnCollection.cs
- TrackingValidationObjectDictionary.cs
- _LazyAsyncResult.cs
- Span.cs
- EventPropertyMap.cs
- DataDocumentXPathNavigator.cs
- NavigateUrlConverter.cs
- WebColorConverter.cs
- DataListItemCollection.cs
- SessionParameter.cs
- TemplateControlCodeDomTreeGenerator.cs
- SqlCrossApplyToCrossJoin.cs
- PenThreadPool.cs
- MSAANativeProvider.cs
- DomNameTable.cs
- Queue.cs
- ConfigXmlAttribute.cs
- MiniMapControl.xaml.cs
- StorageFunctionMapping.cs
- UpdateTranslator.cs
- HandlerBase.cs
- FormViewDeleteEventArgs.cs
- ReplyChannel.cs
- NestedContainer.cs
- ManagementOperationWatcher.cs
- LogSwitch.cs
- PhysicalOps.cs
- cookieexception.cs
- HandleRef.cs
- BinaryUtilClasses.cs
- SerializationFieldInfo.cs
- XmlILCommand.cs
- ColorTransform.cs
- PageAdapter.cs
- SimpleMailWebEventProvider.cs
- AnimationTimeline.cs
- FixedDocument.cs
- TrueReadOnlyCollection.cs
- DataGridColumnDropSeparator.cs
- HandlerBase.cs
- DataGridDesigner.cs
- XsdCachingReader.cs
- TransformerInfoCollection.cs
- NamespaceQuery.cs
- HtmlTableRow.cs
- RegexGroup.cs
- ContextDataSourceView.cs
- RegionData.cs
- GiveFeedbackEventArgs.cs
- DataRowExtensions.cs
- ClientSettingsStore.cs
- XmlSerializer.cs
- MimeImporter.cs
- XmlSchemaSimpleType.cs
- PersonalizationStateInfo.cs
- Timer.cs
- ObjectViewFactory.cs
- FixedTextView.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- DataTableReaderListener.cs
- WindowsToolbarAsMenu.cs
- EventMappingSettingsCollection.cs
- PermissionRequestEvidence.cs
- AspNetHostingPermission.cs
- PixelFormat.cs
- BuildManager.cs
- ClassDataContract.cs
- dataSvcMapFileLoader.cs
- ServiceXNameTypeConverter.cs
- BuildProvider.cs
- MTConfigUtil.cs
- HtmlAnchor.cs
- RuntimeEnvironment.cs
- ToolStripPanel.cs
- SliderAutomationPeer.cs
- XPathNodeList.cs
- SignHashRequest.cs
- OleDbFactory.cs
- DataKey.cs
- TcpChannelListener.cs
- FlowLayout.cs
- SafePointer.cs
- _NestedSingleAsyncResult.cs
- Thumb.cs
- IBuiltInEvidence.cs
- MediaPlayer.cs
- SafeThemeHandle.cs
- HtmlInputControl.cs