Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / ActionMessageFilter.cs / 1 / ActionMessageFilter.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Dispatcher
{
using System;
using System.ServiceModel.Channels;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Runtime.Serialization;
[DataContract]
public class ActionMessageFilter : MessageFilter
{
Dictionary actions;
ReadOnlyCollection actionSet;
[DataMember(IsRequired = true)]
internal string[] DCActions
{
get
{
string[] act = new string[this.actions.Count];
actions.Keys.CopyTo(act, 0);
return act;
}
set
{
Init(value);
}
}
public ActionMessageFilter(params string[] actions)
{
if(actions == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("actions");
}
Init(actions);
}
void Init(string[] actions)
{
if(actions.Length == 0)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.ActionFilterEmptyList), "actions"));
}
this.actions = new Dictionary();
for(int i = 0; i < actions.Length; ++i)
{
// Duplicates are removed
if(!this.actions.ContainsKey(actions[i]))
{
this.actions.Add(actions[i],0);
}
}
}
public ReadOnlyCollection Actions
{
get
{
if(this.actionSet == null)
{
this.actionSet = new ReadOnlyCollection(new List(this.actions.Keys));
}
return this.actionSet;
}
}
protected internal override IMessageFilterTable CreateFilterTable()
{
return new ActionMessageFilterTable();
}
bool InnerMatch(Message message)
{
string act = message.Headers.Action;
if(act == null)
{
act = string.Empty;
}
return this.actions.ContainsKey(act);
}
public override bool Match(Message message)
{
if(message == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
}
return InnerMatch(message);
}
public override bool Match(MessageBuffer messageBuffer)
{
if(messageBuffer == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("messageBuffer");
}
Message msg = messageBuffer.CreateMessage();
try
{
return InnerMatch(msg);
}
finally
{
msg.Close();
}
}
}
}
// 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
- SafeThreadHandle.cs
- WebReferencesBuildProvider.cs
- StrongNameUtility.cs
- TypeLibConverter.cs
- _BufferOffsetSize.cs
- RbTree.cs
- figurelengthconverter.cs
- ProjectionPath.cs
- ControlPaint.cs
- DurationConverter.cs
- ObjectStateManagerMetadata.cs
- CacheOutputQuery.cs
- TimeSpanStorage.cs
- BulletChrome.cs
- DragDrop.cs
- Int32CollectionConverter.cs
- SharedDp.cs
- ToolboxComponentsCreatingEventArgs.cs
- SqlDeflator.cs
- GPRECTF.cs
- WebPartMinimizeVerb.cs
- StringKeyFrameCollection.cs
- UICuesEvent.cs
- PageSetupDialog.cs
- XamlFilter.cs
- ExpressionEvaluator.cs
- Control.cs
- ProfileSection.cs
- FileDataSourceCache.cs
- HtmlShimManager.cs
- UriParserTemplates.cs
- BufferModeSettings.cs
- ToolStripPanelRenderEventArgs.cs
- HtmlLinkAdapter.cs
- FlowDocumentReaderAutomationPeer.cs
- GenericAuthenticationEventArgs.cs
- WithParamAction.cs
- NavigationHelper.cs
- ToolStripPanelRow.cs
- ListViewItem.cs
- GenericFlowSwitchHelper.cs
- Rect3DConverter.cs
- SymbolTable.cs
- TrustManagerMoreInformation.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- ConsoleCancelEventArgs.cs
- ListBase.cs
- DataGridColumn.cs
- CodeGen.cs
- _LoggingObject.cs
- LogRecordSequence.cs
- ToolStripSystemRenderer.cs
- _LoggingObject.cs
- _ShellExpression.cs
- KeyedCollection.cs
- HScrollBar.cs
- StateItem.cs
- SafeRightsManagementPubHandle.cs
- VisualTreeHelper.cs
- SqlDataSourceCustomCommandPanel.cs
- MediaCommands.cs
- UpdateManifestForBrowserApplication.cs
- DataSourceControl.cs
- Grant.cs
- SequenceDesigner.cs
- TheQuery.cs
- InfoCardBinaryReader.cs
- ConfigXmlSignificantWhitespace.cs
- DefaultProxySection.cs
- StyleXamlParser.cs
- InternalSafeNativeMethods.cs
- _HeaderInfo.cs
- HtmlShim.cs
- ButtonPopupAdapter.cs
- XmlNodeChangedEventArgs.cs
- MethodExecutor.cs
- nulltextnavigator.cs
- BitFlagsGenerator.cs
- COM2PropertyBuilderUITypeEditor.cs
- Pen.cs
- FixedSOMContainer.cs
- StylusOverProperty.cs
- BinaryParser.cs
- PtsContext.cs
- ping.cs
- Section.cs
- NamedPermissionSet.cs
- ReplyChannel.cs
- IInstanceTable.cs
- SqlUnionizer.cs
- PrtCap_Public_Simple.cs
- HtmlInputControl.cs
- TableItemStyle.cs
- RequestQueue.cs
- TextDecorationCollection.cs
- ActivityTypeCodeDomSerializer.cs
- ADMembershipUser.cs
- IsolatedStorageFile.cs
- HoistedLocals.cs
- PropertyCollection.cs