Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Wsat / Messaging / Activation.cs / 1 / Activation.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- // Define the interfaces and infrastructure needed to receive activation messages using System; using System.ServiceModel.Channels; using System.Diagnostics; using System.ServiceModel; using System.Transactions; using Microsoft.Transactions.Wsat.Protocol; using DiagnosticUtility = Microsoft.Transactions.Bridge.DiagnosticUtility; namespace Microsoft.Transactions.Wsat.Messaging { // // Activation Interfaces // interface IActivationCoordinator { void CreateCoordinationContext (Message message, RequestAsyncResult result); } class ActivationCoordinatorDispatcher : RequestMessageDispatcher { CoordinationService service; IActivationCoordinator dispatch; public ActivationCoordinatorDispatcher(CoordinationService service, IActivationCoordinator dispatch) { this.service = service; this.dispatch = dispatch; } protected override void SendFaultReply(RequestAsyncResult result, Fault fault) { ActivationProxy.SendFaultResponse(result, fault); } public IAsyncResult BeginCreateCoordinationContext(Message message, AsyncCallback callback, object state) { if (DebugTrace.Verbose) { DebugTrace.Trace(TraceLevel.Verbose, "Dispatching CreateCoordinationContext request"); if (DebugTrace.Pii) DebugTrace.TracePii(TraceLevel.Verbose, "Sender is {0}", CoordinationServiceSecurity.GetSenderName(message)); } RequestAsyncResult result = new RequestAsyncResult(message, callback, state); try { this.dispatch.CreateCoordinationContext(message, result); } catch (InvalidMessageException e) { DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); this.OnMessageException(result, message, e, Faults.Version(this.service.ProtocolVersion).InvalidParameters); } catch (CommunicationException e) { DiagnosticUtility.ExceptionUtility.TraceHandledException(e, TraceEventType.Warning); this.OnMessageException(result, message, e, Faults.Version(this.service.ProtocolVersion).CreateContextDispatchFailed); } #pragma warning suppress 56500 // Only catch Exception for InvokeFinalHandler catch (Exception e) { DebugTrace.Trace( TraceLevel.Error, "Unhandled exception {0} dispatching CreateCoordinationContext message: {1}", e.GetType().Name, e ); // Contractually the dispatch object can only throw CommunicationException. // Our implementation is very careful to only throw this type of exception // (e.g. when deserializing a malformed message body or header...) // Any other exception indicates that things have gone seriously wrong, // so we cannot be trusted to process further messages. This is a QFE-worthy event. DiagnosticUtility.InvokeFinalHandler(e); } return result; } public Message EndCreateCoordinationContext(IAsyncResult ar) { RequestAsyncResult result = (RequestAsyncResult) ar; result.End(); return result.Reply; } public static IWSActivationCoordinator Instance(CoordinationService service, IActivationCoordinator dispatch) { ProtocolVersionHelper.AssertProtocolVersion(service.ProtocolVersion, typeof(ActivationCoordinatorDispatcher), "Instance"); //assert valid protocol version switch (service.ProtocolVersion) { case ProtocolVersion.Version10: return new ActivationCoordinatorDispatcher10(service, dispatch); case ProtocolVersion.Version11: return new ActivationCoordinatorDispatcher11(service, dispatch); default: return null; // inaccessible path because we have asserted the protocol version } } } [ServiceBehavior( InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] class ActivationCoordinatorDispatcher10 : IWSActivationCoordinator10 { ActivationCoordinatorDispatcher activationCoordinatorDispatcher; public ActivationCoordinatorDispatcher10(CoordinationService service, IActivationCoordinator dispatch) { ProtocolVersionHelper.AssertProtocolVersion10(service.ProtocolVersion, typeof(ActivationCoordinatorDispatcher10), "constr"); this.activationCoordinatorDispatcher = new ActivationCoordinatorDispatcher(service, dispatch); } public Type ContractType { get { return typeof(IWSActivationCoordinator10); } } public IAsyncResult BeginCreateCoordinationContext(Message message, AsyncCallback callback, object state) { return this.activationCoordinatorDispatcher.BeginCreateCoordinationContext(message, callback, state); } public Message EndCreateCoordinationContext(IAsyncResult ar) { return this.activationCoordinatorDispatcher.EndCreateCoordinationContext(ar); } } [ServiceBehavior( InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] class ActivationCoordinatorDispatcher11 : IWSActivationCoordinator11 { ActivationCoordinatorDispatcher activationCoordinatorDispatcher; public ActivationCoordinatorDispatcher11(CoordinationService service, IActivationCoordinator dispatch) { ProtocolVersionHelper.AssertProtocolVersion11(service.ProtocolVersion, typeof(ActivationCoordinatorDispatcher11), "constr"); this.activationCoordinatorDispatcher = new ActivationCoordinatorDispatcher(service, dispatch); } public Type ContractType { get { return typeof(IWSActivationCoordinator11); } } public IAsyncResult BeginCreateCoordinationContext(Message message, AsyncCallback callback, object state) { return this.activationCoordinatorDispatcher.BeginCreateCoordinationContext(message, callback, state); } public Message EndCreateCoordinationContext(IAsyncResult ar) { return this.activationCoordinatorDispatcher.EndCreateCoordinationContext(ar); } } } // 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
- OptimalTextSource.cs
- StringUtil.cs
- XPathDocumentIterator.cs
- Formatter.cs
- JournalEntryListConverter.cs
- safemediahandle.cs
- DataSetSchema.cs
- MaskInputRejectedEventArgs.cs
- HtmlInputReset.cs
- DictionarySectionHandler.cs
- BrowserCapabilitiesFactory.cs
- WindowsMenu.cs
- ToolStrip.cs
- RequestCacheManager.cs
- DetailsViewModeEventArgs.cs
- SoapHeaderException.cs
- ListBase.cs
- BulletChrome.cs
- FormattedText.cs
- BulletChrome.cs
- TraversalRequest.cs
- BStrWrapper.cs
- PathTooLongException.cs
- AVElementHelper.cs
- AuthenticationConfig.cs
- IEnumerable.cs
- ListViewAutomationPeer.cs
- AnimatedTypeHelpers.cs
- SamlAction.cs
- CommandHelper.cs
- Baml6Assembly.cs
- EffectiveValueEntry.cs
- XmlSchemaParticle.cs
- TemplateControlCodeDomTreeGenerator.cs
- InkCanvasAutomationPeer.cs
- XmlBinaryReaderSession.cs
- PagesChangedEventArgs.cs
- _SSPIWrapper.cs
- SessionStateContainer.cs
- WebPartManagerInternals.cs
- CategoryAttribute.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- Pair.cs
- codemethodreferenceexpression.cs
- SafeMILHandle.cs
- AttributeProviderAttribute.cs
- RegularExpressionValidator.cs
- UriTemplate.cs
- XmlExtensionFunction.cs
- XmlSchemaElement.cs
- SystemPens.cs
- OperandQuery.cs
- DependencyPropertyChangedEventArgs.cs
- AttachedPropertyMethodSelector.cs
- OracleBoolean.cs
- HtmlInputImage.cs
- MergablePropertyAttribute.cs
- DataGridToolTip.cs
- AutomationElementCollection.cs
- HttpWebRequestElement.cs
- FileLevelControlBuilderAttribute.cs
- HtmlTable.cs
- DataGridColumnCollection.cs
- TextRunCacheImp.cs
- InvokeProviderWrapper.cs
- ToolStripOverflowButton.cs
- SqlServer2KCompatibilityCheck.cs
- SmiRequestExecutor.cs
- ConfigurationException.cs
- NonBatchDirectoryCompiler.cs
- CompilerParameters.cs
- WpfPayload.cs
- XomlCompilerHelpers.cs
- ResourcesGenerator.cs
- XmlDocumentSchema.cs
- XmlValidatingReaderImpl.cs
- ToolStripLocationCancelEventArgs.cs
- TextEditorLists.cs
- EmptyQuery.cs
- TitleStyle.cs
- TagMapInfo.cs
- MarginCollapsingState.cs
- DataGridColumn.cs
- FieldToken.cs
- VSWCFServiceContractGenerator.cs
- IdentityHolder.cs
- AbstractExpressions.cs
- QueryOutputWriter.cs
- _UriSyntax.cs
- AttributeTableBuilder.cs
- NameSpaceExtractor.cs
- HostedImpersonationContext.cs
- ArrayHelper.cs
- ListViewItem.cs
- IDReferencePropertyAttribute.cs
- SimpleHandlerFactory.cs
- TableCellAutomationPeer.cs
- wgx_sdk_version.cs
- GridViewColumnCollection.cs
- Function.cs