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
- MILUtilities.cs
- TypeDependencyAttribute.cs
- XmlParserContext.cs
- ExpandCollapsePattern.cs
- ConfigurationValidatorBase.cs
- QilGeneratorEnv.cs
- EmissiveMaterial.cs
- WorkflowWebHostingModule.cs
- ItemCollection.cs
- GeometryHitTestResult.cs
- HttpModuleCollection.cs
- GeneralTransform3D.cs
- DataServiceExpressionVisitor.cs
- ScrollBarAutomationPeer.cs
- URLMembershipCondition.cs
- RegexRunner.cs
- ToolStripContentPanelRenderEventArgs.cs
- TableDetailsCollection.cs
- RootDesignerSerializerAttribute.cs
- ThreadAttributes.cs
- AnnotationHighlightLayer.cs
- BitmapCodecInfoInternal.cs
- TextTreeRootTextBlock.cs
- ProcessProtocolHandler.cs
- TraceLevelStore.cs
- UnmanagedMemoryStreamWrapper.cs
- BuildProvidersCompiler.cs
- DataException.cs
- TemplateBindingExpressionConverter.cs
- TextSerializer.cs
- StrokeNodeData.cs
- OptimizedTemplateContent.cs
- TableItemPattern.cs
- TabletCollection.cs
- DesignerOptionService.cs
- SafeFileMapViewHandle.cs
- EnumDataContract.cs
- ItemCheckedEvent.cs
- FontCacheUtil.cs
- XmlSchemaExporter.cs
- XmlName.cs
- InstalledVoice.cs
- OleServicesContext.cs
- DataSourceXmlSerializer.cs
- Viewport2DVisual3D.cs
- RectAnimationClockResource.cs
- ColumnHeaderConverter.cs
- ObjectListShowCommandsEventArgs.cs
- TypeUtils.cs
- ScriptReference.cs
- FormViewRow.cs
- TransactionManager.cs
- DLinqColumnProvider.cs
- FolderBrowserDialog.cs
- SqlGatherProducedAliases.cs
- UnwrappedTypesXmlSerializerManager.cs
- RestClientProxyHandler.cs
- GlyphingCache.cs
- ContentElement.cs
- OneWayElement.cs
- DataGridViewRow.cs
- DocumentXmlWriter.cs
- XmlDocumentType.cs
- LabelLiteral.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- DataGridRowEventArgs.cs
- followingsibling.cs
- CqlQuery.cs
- SqlCommand.cs
- CancellationTokenSource.cs
- xamlnodes.cs
- Latin1Encoding.cs
- BasePropertyDescriptor.cs
- Formatter.cs
- OneOf.cs
- OleServicesContext.cs
- DiscoveryReferences.cs
- ButtonFlatAdapter.cs
- ScrollProviderWrapper.cs
- Roles.cs
- XmlSerializationGeneratedCode.cs
- CatalogZoneBase.cs
- ProvidersHelper.cs
- XamlPathDataSerializer.cs
- ThreadAbortException.cs
- DataGridColumnDropSeparator.cs
- KeyTime.cs
- SafeLibraryHandle.cs
- ContainerParagraph.cs
- DebugView.cs
- SoapAttributeOverrides.cs
- CompilationUtil.cs
- _ProxyRegBlob.cs
- HttpContext.cs
- DialogResultConverter.cs
- HtmlToClrEventProxy.cs
- DataStorage.cs
- VirtualPathProvider.cs
- CodeTypeConstructor.cs
- _UriTypeConverter.cs