コード例 #1
0
        static OleTxTransactionHeader ReadFrom(XmlDictionaryReader reader)
        {
            WsatExtendedInformation info = null;

            if (reader.IsStartElement(XD.OleTxTransactionExternalDictionary.OleTxTransaction,
                                      XD.OleTxTransactionExternalDictionary.Namespace))
            {
                string identifier = reader.GetAttribute(XD.CoordinationExternalDictionary.Identifier, CoordinationNamespace);

                if (!string.IsNullOrEmpty(identifier))
                {
                    // Verify identifier is really a URI
                    Uri uri;
                    if (!Uri.TryCreate(identifier, UriKind.Absolute, out uri))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidWsatExtendedInfo)));
                    }
                }

                string attr = reader.GetAttribute(XD.CoordinationExternalDictionary.Expires, CoordinationNamespace);

                uint timeout = 0;
                if (!string.IsNullOrEmpty(attr))
                {
                    try
                    {
                        timeout = XmlConvert.ToUInt32(attr);
                    }
                    catch (FormatException e)
                    {
                        DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidWsatExtendedInfo), e));
                    }
                    catch (OverflowException e)
                    {
                        DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidWsatExtendedInfo), e));
                    }
                }

                if (!string.IsNullOrEmpty(identifier) || timeout != 0)
                {
                    info = new WsatExtendedInformation(identifier, timeout);
                }
            }

            reader.ReadFullStartElement(XD.OleTxTransactionExternalDictionary.OleTxTransaction,
                                        XD.OleTxTransactionExternalDictionary.Namespace);

            byte[] propagationToken = ReadPropagationTokenElement(reader);

            // Skip extensibility elements...
            while (reader.IsStartElement())
            {
                reader.Skip();
            }
            reader.ReadEndElement();

            return(new OleTxTransactionHeader(propagationToken, info));
        }
コード例 #2
0
        public override Transaction UnmarshalTransaction()
        {
            Transaction tx;

            if (WsatIncomingTransactionCache.Find(this.context.Identifier, out tx))
                return tx;

            tx = this.wsatProxy.UnmarshalTransaction(this);

            // Cache extended information for subsequent marshal operations
            WsatExtendedInformation info = new WsatExtendedInformation(context.Identifier, context.Expires);
            info.TryCache(tx);

            // Cache the unmarshalled transaction for subsequent unmarshal operations
            WsatIncomingTransactionCache.Cache(this.context.Identifier, tx);

            return tx;
        }
コード例 #3
0
        public override Transaction UnmarshalTransaction()
        {
            Transaction tx;

            if (WsatIncomingTransactionCache.Find(this.context.Identifier, out tx))
            {
                return(tx);
            }

            tx = this.wsatProxy.UnmarshalTransaction(this);

            // Cache extended information for subsequent marshal operations
            WsatExtendedInformation info = new WsatExtendedInformation(context.Identifier, context.Expires);

            info.TryCache(tx);

            // Cache the unmarshalled transaction for subsequent unmarshal operations
            WsatIncomingTransactionCache.Cache(this.context.Identifier, tx);

            return(tx);
        }
コード例 #4
0
 public OleTxTransactionHeader(byte[] propagationToken, WsatExtendedInformation wsatInfo)
 {
     this.propagationToken = propagationToken;
     this.wsatInfo         = wsatInfo;
 }
コード例 #5
0
 public OleTxTransactionHeader(byte[] propagationToken, WsatExtendedInformation wsatInfo)
 {
     this.propagationToken = propagationToken;
     this.wsatInfo = wsatInfo;
 }
コード例 #6
0
        static OleTxTransactionHeader ReadFrom(XmlDictionaryReader reader)
        {
            WsatExtendedInformation info = null;

            if (reader.IsStartElement(XD.OleTxTransactionExternalDictionary.OleTxTransaction,
                                      XD.OleTxTransactionExternalDictionary.Namespace))
            {
                string identifier = reader.GetAttribute(XD.CoordinationExternalDictionary.Identifier, CoordinationNamespace);

                if (!string.IsNullOrEmpty(identifier))
                {
                    // Verify identifier is really a URI
                    Uri uri;
                    if (!Uri.TryCreate(identifier, UriKind.Absolute, out uri))
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidWsatExtendedInfo)));
                    }
                }

                string attr = reader.GetAttribute(XD.CoordinationExternalDictionary.Expires, CoordinationNamespace);

                uint timeout = 0;
                if (!string.IsNullOrEmpty(attr))
                {
                    try
                    {
                        timeout = XmlConvert.ToUInt32(attr);
                    }
                    catch (FormatException e)
                    {
                        DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidWsatExtendedInfo), e));
                    }
                    catch (OverflowException e)
                    {
                        DiagnosticUtility.TraceHandledException(e, TraceEventType.Error);
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidWsatExtendedInfo), e));
                    }
                }

                if (!string.IsNullOrEmpty(identifier) || timeout != 0)
                {
                    info = new WsatExtendedInformation(identifier, timeout);
                }
            }

            reader.ReadFullStartElement(XD.OleTxTransactionExternalDictionary.OleTxTransaction,
                                        XD.OleTxTransactionExternalDictionary.Namespace);

            byte[] propagationToken = ReadPropagationTokenElement(reader);

            // Skip extensibility elements...
            while (reader.IsStartElement())
            {
                reader.Skip();
            }
            reader.ReadEndElement();

            return new OleTxTransactionHeader(propagationToken, info);
        }