Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / DiscoveryService.cs / 1305376 / DiscoveryService.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Discovery { using System.Runtime; using System.ServiceModel; using System.ServiceModel.Discovery.Version11; using System.ServiceModel.Discovery.VersionApril2005; using System.ServiceModel.Discovery.VersionCD1; using System.Xml; using System.Globalization; [Fx.Tag.XamlVisible(false)] public abstract class DiscoveryService : IDiscoveryContractAdhocApril2005, IDiscoveryContractManagedApril2005, IDiscoveryContractAdhoc11, IDiscoveryContractManaged11, IDiscoveryContractAdhocCD1, IDiscoveryContractManagedCD1, IDiscoveryServiceImplementation { DiscoveryMessageSequenceGenerator messageSequenceGenerator; DuplicateDetectorduplicateDetector; protected DiscoveryService() : this(new DiscoveryMessageSequenceGenerator()) { } protected DiscoveryService(DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator) : this(discoveryMessageSequenceGenerator, DiscoveryDefaults.DuplicateMessageHistoryLength) { } protected DiscoveryService( DiscoveryMessageSequenceGenerator discoveryMessageSequenceGenerator, int duplicateMessageHistoryLength) { if (discoveryMessageSequenceGenerator == null) { throw FxTrace.Exception.ArgumentNull("messageSequenceGenerator"); } if (duplicateMessageHistoryLength < 0) { throw FxTrace.Exception.ArgumentOutOfRange( "duplicateMessageHistoryLength", duplicateMessageHistoryLength, SR.DiscoveryNegativeDuplicateMessageHistoryLength); } if (duplicateMessageHistoryLength > 0) { this.duplicateDetector = new DuplicateDetector (duplicateMessageHistoryLength); } this.messageSequenceGenerator = discoveryMessageSequenceGenerator; } internal DiscoveryMessageSequenceGenerator MessageSequenceGenerator { get { return this.messageSequenceGenerator; } } void IDiscoveryContractApril2005.ProbeOperation(ProbeMessageApril2005 request) { Fx.Assert("The [....] method IDiscoveryContractApril2005.ProbeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IDiscoveryContractApril2005.BeginProbeOperation(ProbeMessageApril2005 request, AsyncCallback callback, object state) { return new ProbeDuplexApril2005AsyncResult(request, this, null, callback, state); } void IDiscoveryContractApril2005.EndProbeOperation(IAsyncResult result) { ProbeDuplexApril2005AsyncResult.End(result); } void IDiscoveryContractApril2005.ResolveOperation(ResolveMessageApril2005 request) { Fx.Assert("The [....] method IDiscoveryContractApril2005.ResolveOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IDiscoveryContractApril2005.BeginResolveOperation(ResolveMessageApril2005 request, AsyncCallback callback, object state) { return new ResolveDuplexApril2005AsyncResult(request, this, null, callback, state); } void IDiscoveryContractApril2005.EndResolveOperation(IAsyncResult result) { ResolveDuplexApril2005AsyncResult.End(result); } void IDiscoveryContractAdhoc11.ProbeOperation(ProbeMessage11 request) { Fx.Assert("The [....] method IDiscoveryContractAdhoc11.ProbeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IDiscoveryContractAdhoc11.BeginProbeOperation(ProbeMessage11 request, AsyncCallback callback, object state) { return new ProbeDuplex11AsyncResult(request, this, null, callback, state); } void IDiscoveryContractAdhoc11.EndProbeOperation(IAsyncResult result) { ProbeDuplex11AsyncResult.End(result); } void IDiscoveryContractAdhoc11.ResolveOperation(ResolveMessage11 request) { Fx.Assert("The [....] method IDiscoveryContractAdhoc11.ResolveOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IDiscoveryContractAdhoc11.BeginResolveOperation(ResolveMessage11 request, AsyncCallback callback, object state) { return new ResolveDuplex11AsyncResult(request, this, null, callback, state); } void IDiscoveryContractAdhoc11.EndResolveOperation(IAsyncResult result) { ResolveDuplex11AsyncResult.End(result); } ProbeMatchesMessage11 IDiscoveryContractManaged11.ProbeOperation(ProbeMessage11 request) { Fx.Assert("The [....] method IDiscoveryContractManaged11.ProbeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); return null; } IAsyncResult IDiscoveryContractManaged11.BeginProbeOperation(ProbeMessage11 request, AsyncCallback callback, object state) { return new ProbeRequestResponse11AsyncResult(request, this, callback, state); } ProbeMatchesMessage11 IDiscoveryContractManaged11.EndProbeOperation(IAsyncResult result) { return ProbeRequestResponse11AsyncResult.End(result); } ResolveMatchesMessage11 IDiscoveryContractManaged11.ResolveOperation(ResolveMessage11 request) { Fx.Assert("The [....] method IDiscoveryContractManaged11.ResolveOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); return null; } IAsyncResult IDiscoveryContractManaged11.BeginResolveOperation(ResolveMessage11 request, AsyncCallback callback, object state) { return new ResolveRequestResponse11AsyncResult(request, this, callback, state); } ResolveMatchesMessage11 IDiscoveryContractManaged11.EndResolveOperation(IAsyncResult result) { return ResolveRequestResponse11AsyncResult.End(result); } void IDiscoveryContractAdhocCD1.ProbeOperation(ProbeMessageCD1 request) { Fx.Assert("The [....] method IDiscoveryContractAdhocCD1.ProbeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IDiscoveryContractAdhocCD1.BeginProbeOperation(ProbeMessageCD1 request, AsyncCallback callback, object state) { return new ProbeDuplexCD1AsyncResult(request, this, null, callback, state); } void IDiscoveryContractAdhocCD1.EndProbeOperation(IAsyncResult result) { ProbeDuplexCD1AsyncResult.End(result); } void IDiscoveryContractAdhocCD1.ResolveOperation(ResolveMessageCD1 request) { Fx.Assert("The [....] method IDiscoveryContractAdhocCD1.ResolveOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); } IAsyncResult IDiscoveryContractAdhocCD1.BeginResolveOperation(ResolveMessageCD1 request, AsyncCallback callback, object state) { return new ResolveDuplexCD1AsyncResult(request, this, null, callback, state); } void IDiscoveryContractAdhocCD1.EndResolveOperation(IAsyncResult result) { ResolveDuplexCD1AsyncResult.End(result); } ProbeMatchesMessageCD1 IDiscoveryContractManagedCD1.ProbeOperation(ProbeMessageCD1 request) { Fx.Assert("The [....] method IDiscoveryContractManagedCD1.ProbeOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); return null; } IAsyncResult IDiscoveryContractManagedCD1.BeginProbeOperation(ProbeMessageCD1 request, AsyncCallback callback, object state) { return new ProbeRequestResponseCD1AsyncResult(request, this, callback, state); } ProbeMatchesMessageCD1 IDiscoveryContractManagedCD1.EndProbeOperation(IAsyncResult result) { return ProbeRequestResponseCD1AsyncResult.End(result); } ResolveMatchesMessageCD1 IDiscoveryContractManagedCD1.ResolveOperation(ResolveMessageCD1 request) { Fx.Assert("The [....] method IDiscoveryContractManagedCD1.ResolveOperation must not get invoked. It is marked with PreferAsyncInvocation flag."); return null; } IAsyncResult IDiscoveryContractManagedCD1.BeginResolveOperation(ResolveMessageCD1 request, AsyncCallback callback, object state) { return new ResolveRequestResponseCD1AsyncResult(request, this, callback, state); } ResolveMatchesMessageCD1 IDiscoveryContractManagedCD1.EndResolveOperation(IAsyncResult result) { return ResolveRequestResponseCD1AsyncResult.End(result); } bool IDiscoveryServiceImplementation.IsDuplicate(UniqueId messageId) { return (this.duplicateDetector != null) && (!this.duplicateDetector.AddIfNotDuplicate(messageId)); } DiscoveryMessageSequence IDiscoveryServiceImplementation.GetNextMessageSequence() { return this.messageSequenceGenerator.Next(); } IAsyncResult IDiscoveryServiceImplementation.BeginFind(FindRequestContext findRequestContext, AsyncCallback callback, object state) { return this.OnBeginFind(findRequestContext, callback, state); } void IDiscoveryServiceImplementation.EndFind(IAsyncResult result) { this.OnEndFind(result); } IAsyncResult IDiscoveryServiceImplementation.BeginResolve(ResolveCriteria resolveCriteria, AsyncCallback callback, object state) { return this.OnBeginResolve(resolveCriteria, callback, state); } EndpointDiscoveryMetadata IDiscoveryServiceImplementation.EndResolve(IAsyncResult result) { return this.OnEndResolve(result); } internal static bool EnsureMessageId() { if (OperationContext.Current.IncomingMessageHeaders.MessageId == null) { if (TD.DiscoveryMessageWithNullMessageIdIsEnabled()) { TD.DiscoveryMessageWithNullMessageId( string.Format( CultureInfo.InvariantCulture, "{0}/{1}", ProtocolStrings.TracingStrings.Probe, ProtocolStrings.TracingStrings.Resolve)); } return false; } return true; } internal static bool EnsureReplyTo() { if (OperationContext.Current.IncomingMessageHeaders.ReplyTo == null) { if(TD.DiscoveryMessageWithNullReplyToIsEnabled()) { TD.DiscoveryMessageWithNullReplyTo(OperationContext.Current.IncomingMessageHeaders.MessageId.ToString()); } return false; } return true; } protected abstract IAsyncResult OnBeginFind(FindRequestContext findRequestContext, AsyncCallback callback, object state); protected abstract void OnEndFind(IAsyncResult result); protected abstract IAsyncResult OnBeginResolve(ResolveCriteria resolveCriteria, AsyncCallback callback, object state); protected abstract EndpointDiscoveryMetadata OnEndResolve(IAsyncResult result); } } // 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
- Int32Storage.cs
- WebPartDisplayModeCollection.cs
- DocumentPaginator.cs
- ListMarkerLine.cs
- SecurityElement.cs
- HttpContextBase.cs
- GACMembershipCondition.cs
- SimpleApplicationHost.cs
- MimeParameters.cs
- ExpressionBindings.cs
- BindStream.cs
- ConfigurationErrorsException.cs
- Size3D.cs
- AssignDesigner.xaml.cs
- SortExpressionBuilder.cs
- JsonWriter.cs
- AQNBuilder.cs
- WSSecureConversationDec2005.cs
- LinqDataSourceInsertEventArgs.cs
- ReadOnlyPropertyMetadata.cs
- CompilerGeneratedAttribute.cs
- StringConverter.cs
- InputScope.cs
- IxmlLineInfo.cs
- GridErrorDlg.cs
- ChangeNode.cs
- FormatterConverter.cs
- TableLayoutRowStyleCollection.cs
- XslNumber.cs
- UInt32.cs
- CustomError.cs
- BlobPersonalizationState.cs
- FunctionUpdateCommand.cs
- BindingSource.cs
- DecimalAnimationUsingKeyFrames.cs
- ISAPIWorkerRequest.cs
- MenuAutomationPeer.cs
- MouseGestureConverter.cs
- safemediahandle.cs
- CapabilitiesAssignment.cs
- mediaeventargs.cs
- TreeNodeCollectionEditor.cs
- Identifier.cs
- safelinkcollection.cs
- SimpleFileLog.cs
- QilReplaceVisitor.cs
- WindowsStatusBar.cs
- PrefixQName.cs
- PrimitiveType.cs
- Int32KeyFrameCollection.cs
- AsyncSerializedWorker.cs
- XPathArrayIterator.cs
- DataTableNameHandler.cs
- Italic.cs
- DigitShape.cs
- DesignerSerializerAttribute.cs
- ColumnMapCopier.cs
- BulletedList.cs
- SafeProcessHandle.cs
- RegexCaptureCollection.cs
- DataPagerFieldCommandEventArgs.cs
- SpeechSynthesizer.cs
- ReliabilityContractAttribute.cs
- SuspendDesigner.cs
- QilInvokeLateBound.cs
- diagnosticsswitches.cs
- EncodingInfo.cs
- METAHEADER.cs
- XPathNode.cs
- TreeNodeCollection.cs
- DataGridColumnCollection.cs
- CodeDomLoader.cs
- CopyEncoder.cs
- GradientStopCollection.cs
- CodeFieldReferenceExpression.cs
- CodeAccessPermission.cs
- Label.cs
- IChannel.cs
- ColumnWidthChangingEvent.cs
- ChtmlTextWriter.cs
- SystemInfo.cs
- SQLBinaryStorage.cs
- ResumeStoryboard.cs
- BuildProviderAppliesToAttribute.cs
- ThicknessKeyFrameCollection.cs
- MessageFormatterConverter.cs
- Binding.cs
- ReplyChannelAcceptor.cs
- Interlocked.cs
- CacheRequest.cs
- _LazyAsyncResult.cs
- ContractSearchPattern.cs
- Automation.cs
- WebConfigurationFileMap.cs
- Clock.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- TypeForwardedToAttribute.cs
- InstanceKeyNotReadyException.cs
- CollectionView.cs
- DmlSqlGenerator.cs