Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Activities / System / ServiceModel / CorrelationQuery.cs / 1305376 / CorrelationQuery.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.ServiceModel
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.ServiceModel.Activities;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;
using SR2 = System.ServiceModel.Activities.SR;
public class CorrelationQuery
{
Collection selectAdditional;
public CorrelationQuery()
{
}
[SuppressMessage(FxCop.Category.Usage, FxCop.Rule.CollectionPropertiesShouldBeReadOnly,
Justification = "TODO 87762, remove the set")]
[SuppressMessage(FxCop.Category.Xaml, FxCop.Rule.PropertyExternalTypesMustBeKnown,
Justification = "This property is XAML friendly, no need to add KnownXamlExternal")]
[DefaultValue(null)]
public MessageQuerySet Select
{
get;
set;
}
public Collection SelectAdditional
{
get
{
if (this.selectAdditional == null)
{
this.selectAdditional = new QueryCollection();
}
return this.selectAdditional;
}
}
[SuppressMessage(FxCop.Category.Xaml, FxCop.Rule.PropertyExternalTypesMustBeKnown,
Justification = "This property is XAML friendly, no need to add KnownXamlExternal")]
[DefaultValue(null)]
public MessageFilter Where
{
get;
set;
}
internal bool IsDefaultContextQuery
{
get;
set;
}
public override bool Equals(object other)
{
if (object.ReferenceEquals(this, other))
{
return true;
}
CorrelationQuery otherQuery = other as CorrelationQuery;
if (otherQuery == null)
{
return false;
}
if (this.Where == null)
{
return otherQuery.Where == null;
}
return this.Where.Equals(otherQuery.Where);
}
public override int GetHashCode()
{
return (this.Where != null) ? this.Where.GetHashCode() : 0;
}
internal static bool IsQueryCollectionSearchable(IEnumerable queries)
{
foreach (CorrelationQuery query in queries)
{
if (!(query.Where is CorrelationActionMessageFilter || query.Where is ActionMessageFilter))
{
return false;
}
}
return true;
}
internal static CorrelationQuery FindCorrelationQueryForAction(IEnumerable queries, string action)
{
string localAction = action != null ? action : String.Empty;
foreach (CorrelationQuery query in queries)
{
// if the action is wildcard, we have a match all
if (query.Where is CorrelationActionMessageFilter)
{
if (((CorrelationActionMessageFilter)query.Where).Action == localAction || localAction == MessageHeaders.WildcardAction)
{
return query;
}
}
else if (query.Where is ActionMessageFilter)
{
if (((ActionMessageFilter)query.Where).Actions.Contains(localAction) || localAction == MessageHeaders.WildcardAction)
{
return query;
}
}
}
return null;
}
internal CorrelationQuery Clone()
{
CorrelationQuery cloneQuery = new CorrelationQuery
{
Select = this.Select,
IsDefaultContextQuery = this.IsDefaultContextQuery,
Where = this.Where,
};
if (this.selectAdditional != null)
{
foreach (MessageQuerySet messageQuerySet in this.selectAdditional)
{
cloneQuery.SelectAdditional.Add(messageQuerySet);
}
}
return cloneQuery;
}
class QueryCollection : Collection
{
public QueryCollection()
{
}
protected override void InsertItem(int index, MessageQuerySet item)
{
if (item == null)
{
throw FxTrace.Exception.ArgumentNull("item");
}
base.InsertItem(index, item);
}
protected override void SetItem(int index, MessageQuerySet item)
{
if (item == null)
{
throw FxTrace.Exception.ArgumentNull("item");
}
base.SetItem(index, item);
}
}
}
}
// 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
- StrokeNodeOperations2.cs
- DataListItem.cs
- InvalidateEvent.cs
- GroupBox.cs
- ProfileSection.cs
- GcHandle.cs
- _Rfc2616CacheValidators.cs
- DataColumnMapping.cs
- MetadataSerializer.cs
- DirectionalAction.cs
- EntityWithKeyStrategy.cs
- DiscreteKeyFrames.cs
- RedistVersionInfo.cs
- HierarchicalDataTemplate.cs
- AggregateException.cs
- IPAddressCollection.cs
- AnimationTimeline.cs
- OlePropertyStructs.cs
- NetworkStream.cs
- MaskedTextBoxDesignerActionList.cs
- InheritedPropertyChangedEventArgs.cs
- AuthenticationService.cs
- SplitterPanelDesigner.cs
- GridViewRowCollection.cs
- ReceiveContent.cs
- NullableFloatMinMaxAggregationOperator.cs
- FileSecurity.cs
- UnknownBitmapEncoder.cs
- OleDbCommandBuilder.cs
- SequenceQuery.cs
- RegistryConfigurationProvider.cs
- CannotUnloadAppDomainException.cs
- TiffBitmapDecoder.cs
- DeploymentSectionCache.cs
- Exceptions.cs
- ellipse.cs
- TreeNodeBindingCollection.cs
- Dictionary.cs
- TaskFileService.cs
- WebBrowserUriTypeConverter.cs
- ActivationWorker.cs
- ActivityExecutorDelegateInfo.cs
- TableLayoutPanelBehavior.cs
- XmlSchemaElement.cs
- BindingGroup.cs
- Rule.cs
- CreateSequenceResponse.cs
- ThreadStartException.cs
- PrinterUnitConvert.cs
- ImageCodecInfo.cs
- TileBrush.cs
- XmlLanguageConverter.cs
- HtmlInputHidden.cs
- Documentation.cs
- BridgeDataRecord.cs
- ListItemViewAttribute.cs
- MasterPageCodeDomTreeGenerator.cs
- WebRequest.cs
- EnvelopedSignatureTransform.cs
- MenuItemBinding.cs
- Point4DValueSerializer.cs
- linebase.cs
- ChtmlTextWriter.cs
- ToolStripPanelRow.cs
- SettingsContext.cs
- OdbcPermission.cs
- XhtmlBasicFormAdapter.cs
- RegistryKey.cs
- EqualityComparer.cs
- SetterBaseCollection.cs
- SafeFileMappingHandle.cs
- ObjectDataSourceDesigner.cs
- TypeBuilderInstantiation.cs
- CDSsyncETWBCLProvider.cs
- COM2ComponentEditor.cs
- TabControl.cs
- PathFigureCollectionConverter.cs
- StrongNameKeyPair.cs
- FileClassifier.cs
- UiaCoreApi.cs
- SizeFConverter.cs
- TextBoxView.cs
- OdbcConnectionHandle.cs
- ContactManager.cs
- DataGridViewCellMouseEventArgs.cs
- MarshalByRefObject.cs
- SharedStatics.cs
- FilteredAttributeCollection.cs
- Function.cs
- UpdateExpressionVisitor.cs
- QuaternionAnimation.cs
- Speller.cs
- CachedCompositeFamily.cs
- OdbcTransaction.cs
- FontFamily.cs
- DefaultValueTypeConverter.cs
- SplitContainer.cs
- XPathBuilder.cs
- CodeGroup.cs
- SkewTransform.cs