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
- ScriptRef.cs
- FrameworkElement.cs
- DefinitionUpdate.cs
- DictionaryItemsCollection.cs
- GeometryModel3D.cs
- ItemList.cs
- ListParaClient.cs
- QilNode.cs
- MonikerSyntaxException.cs
- Color.cs
- UInt32Storage.cs
- SoapProtocolImporter.cs
- SafeEventLogWriteHandle.cs
- DataGrid.cs
- _CookieModule.cs
- RectangleGeometry.cs
- FileNotFoundException.cs
- OleDbStruct.cs
- ThreadStaticAttribute.cs
- EndpointAddressElementBase.cs
- RowToFieldTransformer.cs
- HtmlTableCellCollection.cs
- TextElement.cs
- Debugger.cs
- ConstantExpression.cs
- Sequence.cs
- ActivityPreviewDesigner.cs
- EventLog.cs
- NativeMethods.cs
- SystemIPInterfaceProperties.cs
- CapabilitiesPattern.cs
- PeerNameRegistration.cs
- DataObjectSettingDataEventArgs.cs
- NullRuntimeConfig.cs
- ExtensionDataObject.cs
- WebPartMinimizeVerb.cs
- ClientApiGenerator.cs
- EntityCollectionChangedParams.cs
- DataGridLinkButton.cs
- RequestTimeoutManager.cs
- Hex.cs
- ValueProviderWrapper.cs
- SqlDataSourceCommandEventArgs.cs
- BaseComponentEditor.cs
- EntitySqlQueryBuilder.cs
- SqlConnectionString.cs
- SoapFormatterSinks.cs
- ColorTransformHelper.cs
- ProbeMatchesApril2005.cs
- TabControlToolboxItem.cs
- LinkClickEvent.cs
- TogglePatternIdentifiers.cs
- SQLInt32Storage.cs
- HttpApplication.cs
- CodeTypeReferenceExpression.cs
- LogSwitch.cs
- SoapBinding.cs
- FontSource.cs
- DbBuffer.cs
- XmlDataSourceView.cs
- UrlRoutingModule.cs
- RecommendedAsConfigurableAttribute.cs
- ClientApiGenerator.cs
- CounterCreationData.cs
- MetabaseServerConfig.cs
- RSAPKCS1SignatureFormatter.cs
- ArgumentDesigner.xaml.cs
- SafeMemoryMappedViewHandle.cs
- VisualCollection.cs
- WebBrowser.cs
- RuntimeVariableList.cs
- FilterException.cs
- FileDialog.cs
- EdmItemCollection.cs
- ConfigXmlComment.cs
- DataViewSetting.cs
- ButtonStandardAdapter.cs
- MultiAsyncResult.cs
- TimelineClockCollection.cs
- TextBox.cs
- AuthenticationModulesSection.cs
- PolicyLevel.cs
- ObjectSet.cs
- OSFeature.cs
- TreeNode.cs
- ContractMapping.cs
- TreeViewHitTestInfo.cs
- WebPartRestoreVerb.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- Executor.cs
- DataKeyCollection.cs
- CodeBlockBuilder.cs
- LinqDataSource.cs
- messageonlyhwndwrapper.cs
- FixedPageProcessor.cs
- CustomAttributeBuilder.cs
- ValidatorUtils.cs
- BamlWriter.cs
- PersonalizablePropertyEntry.cs
- DataGridCellClipboardEventArgs.cs