Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / DefaultDiscoveryService.cs / 1305376 / DefaultDiscoveryService.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Discovery { using System.Collections.ObjectModel; using System.Runtime; class DefaultDiscoveryService : DiscoveryService { readonly ReadOnlyCollectionpublishedEndpoints; public DefaultDiscoveryService( DiscoveryServiceExtension discoveryServiceExtension, DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator, int duplicateMessageHistoryLength) : base(discoveryMessageSequenceGenerator, duplicateMessageHistoryLength) { Fx.Assert(discoveryServiceExtension != null, "The discoveryServiceExtension must be non null."); this.publishedEndpoints = discoveryServiceExtension.PublishedEndpoints; } protected override IAsyncResult OnBeginFind( FindRequestContext findRequestContext, AsyncCallback callback, object state) { this.Match(findRequestContext); return new CompletedAsyncResult(callback, state); } protected override void OnEndFind(IAsyncResult result) { CompletedAsyncResult.End(result); } protected override IAsyncResult OnBeginResolve(ResolveCriteria resolveCriteria, AsyncCallback callback, object state) { return new CompletedAsyncResult ( this.Match(resolveCriteria), callback, state); } protected override EndpointDiscoveryMetadata OnEndResolve(IAsyncResult result) { return CompletedAsyncResult .End(result); } EndpointDiscoveryMetadata Match(ResolveCriteria criteria) { for (int i = 0; i < this.publishedEndpoints.Count; i++) { if (this.publishedEndpoints[i].Address.Equals(criteria.Address)) { return this.publishedEndpoints[i]; } } return null; } void Match(FindRequestContext findRequestContext) { FindCriteria criteria = findRequestContext.Criteria; if (!ScopeCompiler.IsSupportedMatchingRule(criteria.ScopeMatchBy)) { return; } CompiledScopeCriteria[] compiledScopeCriterias = ScopeCompiler.CompileMatchCriteria( criteria.InternalScopes, criteria.ScopeMatchBy); int matchingEndpointCount = 0; for (int i = 0; i < this.publishedEndpoints.Count; i++) { if (criteria.IsMatch(this.publishedEndpoints[i], compiledScopeCriterias)) { findRequestContext.AddMatchingEndpoint(this.publishedEndpoints[i]); matchingEndpointCount++; if (matchingEndpointCount == criteria.MaxResults) { break; } } } } } } // 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
- BufferedGraphicsManager.cs
- EncoderNLS.cs
- MetadataCache.cs
- XDeferredAxisSource.cs
- OletxDependentTransaction.cs
- GridViewRowCollection.cs
- AsyncStreamReader.cs
- DesignerSerializationVisibilityAttribute.cs
- XmlSchemaRedefine.cs
- HostExecutionContextManager.cs
- TextInfo.cs
- CommonProperties.cs
- CompilationPass2Task.cs
- PageCatalogPart.cs
- TokenBasedSet.cs
- LocalizedNameDescriptionPair.cs
- LambdaSerializationException.cs
- DrawItemEvent.cs
- CompilerLocalReference.cs
- Drawing.cs
- PartDesigner.cs
- BindableAttribute.cs
- BridgeDataReader.cs
- ControlUtil.cs
- BitmapCodecInfo.cs
- OdbcHandle.cs
- TrustSection.cs
- SqlTypeSystemProvider.cs
- DATA_BLOB.cs
- ListMarkerLine.cs
- GeneralTransform3DCollection.cs
- TraceHelpers.cs
- RelationshipSet.cs
- LayoutTableCell.cs
- FamilyMapCollection.cs
- MetadataPropertyCollection.cs
- DefaultBinder.cs
- SplitterPanel.cs
- InternalBufferManager.cs
- Internal.cs
- SeekStoryboard.cs
- DataRelationPropertyDescriptor.cs
- SqlError.cs
- StructuredTypeInfo.cs
- CqlErrorHelper.cs
- SqlDataSourceFilteringEventArgs.cs
- XXXOnTypeBuilderInstantiation.cs
- Transform3DCollection.cs
- ContextBase.cs
- DataControlButton.cs
- HttpVersion.cs
- DebuggerAttributes.cs
- ResourcesChangeInfo.cs
- FontWeightConverter.cs
- ExpressionConverter.cs
- PersonalizationStateQuery.cs
- InkCanvasSelectionAdorner.cs
- Operator.cs
- CodeSnippetExpression.cs
- GlyphingCache.cs
- Triangle.cs
- HtmlHistory.cs
- TransformGroup.cs
- TaskCanceledException.cs
- Normalizer.cs
- _SslState.cs
- ExtensionFile.cs
- MailDefinitionBodyFileNameEditor.cs
- SqlProvider.cs
- EditBehavior.cs
- RawKeyboardInputReport.cs
- PropertyDescriptor.cs
- WebPartConnectVerb.cs
- FixedFlowMap.cs
- XmlSchemaDatatype.cs
- TemplateNameScope.cs
- HttpHandlerAction.cs
- ParallelDesigner.xaml.cs
- RadioButtonList.cs
- TriState.cs
- RadialGradientBrush.cs
- SizeChangedEventArgs.cs
- MessageAction.cs
- DocumentSequence.cs
- VectorValueSerializer.cs
- EnumMember.cs
- FormViewInsertedEventArgs.cs
- TextViewDesigner.cs
- EditorPart.cs
- XmlSchemas.cs
- IteratorAsyncResult.cs
- DataGridViewButtonColumn.cs
- CapabilitiesPattern.cs
- FrameSecurityDescriptor.cs
- mediaeventargs.cs
- SecurityRuntime.cs
- Helpers.cs
- ExceptionUtil.cs
- ContentValidator.cs
- ResourceReader.cs