Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Routing / System / ServiceModel / Dispatcher / EndpointNameMessageFilter.cs / 1305376 / EndpointNameMessageFilter.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System; using System.Diagnostics.CodeAnalysis; using System.Runtime; using System.ServiceModel.Channels; using System.ServiceModel.Dispatcher; using System.ServiceModel.Description; using System.Collections.Generic; using System.Configuration; using System.ServiceModel.Routing; [SuppressMessage(FxCop.Category.Xaml, FxCop.Rule.TypesMustHaveXamlCallableConstructors)] [SuppressMessage(FxCop.Category.Xaml, FxCop.Rule.TypesShouldHavePublicParameterlessConstructors)] public class EndpointNameMessageFilter : MessageFilter { const string EndpointNameKey = "System.ServiceModel.Routing.EndpointNameMessageFilter.Name"; string endpointName; public EndpointNameMessageFilter(string endpointName) { if (string.IsNullOrEmpty(endpointName)) { throw FxTrace.Exception.ArgumentNullOrEmpty("endpointName"); } this.endpointName = endpointName; } public override bool Match(Message message) { if (message == null) { throw FxTrace.Exception.ArgumentNull("message"); } return MatchInternal(message.Properties); } public override bool Match(MessageBuffer buffer) { if (buffer == null) { throw FxTrace.Exception.ArgumentNull("buffer"); } using (Message tempMessage = buffer.CreateMessage()) { return MatchInternal(tempMessage.Properties); } } bool MatchInternal(MessageProperties messageProperties) { object value; if (messageProperties.TryGetValue(EndpointNameKey, out value)) { string messageEndpoint = value.ToString(); return string.Equals(messageEndpoint, this.endpointName, StringComparison.Ordinal); } return false; } internal static void Set(MessageProperties properties, string endpointName) { properties[EndpointNameKey] = endpointName; } internal static void Validate(ICollectionmessageFilters, HashSet endpoints) { foreach (MessageFilter filter in messageFilters) { EndpointNameMessageFilter endpointFilter = filter as EndpointNameMessageFilter; if (endpointFilter != null) { endpointFilter.Validate(endpoints); } } } void Validate(HashSet endpoints) { if (!endpoints.Contains(this.endpointName)) { throw FxTrace.Exception.AsError(new ConfigurationErrorsException(SR.EndpointNameNotFound(this.endpointName))); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Source.cs
- GenericEnumerator.cs
- Choices.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- SelectQueryOperator.cs
- Task.cs
- XmlCompatibilityReader.cs
- LinkedResource.cs
- SessionEndingCancelEventArgs.cs
- XmlNavigatorFilter.cs
- XNodeValidator.cs
- ResizingMessageFilter.cs
- TileBrush.cs
- RuntimeConfig.cs
- ByteStreamGeometryContext.cs
- _LocalDataStore.cs
- MultiByteCodec.cs
- WorkflowCompensationBehavior.cs
- HttpModule.cs
- ResourceManager.cs
- RelativeSource.cs
- GroupBox.cs
- Panel.cs
- SchemaTableColumn.cs
- MultiSelectRootGridEntry.cs
- ObjRef.cs
- NameGenerator.cs
- Parser.cs
- HttpResponseInternalBase.cs
- IxmlLineInfo.cs
- TablePattern.cs
- ToolboxBitmapAttribute.cs
- XamlSerializerUtil.cs
- SplayTreeNode.cs
- ReadWriteObjectLock.cs
- SingleSelectRootGridEntry.cs
- CrossContextChannel.cs
- SqlMethodAttribute.cs
- SoapIgnoreAttribute.cs
- CollectionBase.cs
- CodeBlockBuilder.cs
- Cell.cs
- ObjRef.cs
- __ComObject.cs
- TextBlockAutomationPeer.cs
- Automation.cs
- ButtonFieldBase.cs
- OneOfConst.cs
- HandlerMappingMemo.cs
- HtmlInputRadioButton.cs
- Visual.cs
- OperationPickerDialog.cs
- BindToObject.cs
- DataGridRow.cs
- Timer.cs
- PagesSection.cs
- BaseInfoTable.cs
- WindowsSecurityTokenAuthenticator.cs
- WorkerRequest.cs
- DocumentApplicationJournalEntryEventArgs.cs
- ChannelProtectionRequirements.cs
- EventLogPermissionEntry.cs
- DataGridViewTopRowAccessibleObject.cs
- WebPartConnectionsConnectVerb.cs
- EntityCollection.cs
- DataGridViewRowPostPaintEventArgs.cs
- StorageAssociationTypeMapping.cs
- DataKeyCollection.cs
- DbParameterCollectionHelper.cs
- NameTable.cs
- ExtensionWindow.cs
- SoundPlayerAction.cs
- XmlSchemaAll.cs
- PathNode.cs
- EntityDataSourceState.cs
- XmlResolver.cs
- RegexWorker.cs
- BaseResourcesBuildProvider.cs
- WrappingXamlSchemaContext.cs
- DataGridGeneralPage.cs
- OptimizerPatterns.cs
- KeyTimeConverter.cs
- SelectorAutomationPeer.cs
- WebPartChrome.cs
- PipeStream.cs
- AmbientLight.cs
- SqlLiftIndependentRowExpressions.cs
- WindowsProgressbar.cs
- returneventsaver.cs
- UdpTransportSettingsElement.cs
- ColumnMap.cs
- OneOf.cs
- ExpressionParser.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- CombinedGeometry.cs
- SRGSCompiler.cs
- GifBitmapEncoder.cs
- _Win32.cs
- ViewUtilities.cs
- DefaultBinder.cs