1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using System.Runtime.Serialization;
6 
7 namespace System.Transactions.Distributed
8 {
9     internal sealed class DistributedTransactionManager
10     {
11         internal object NodeName { get; set; }
12 
ReenlistTransaction(Guid resourceManagerIdentifier, byte[] resourceManagerRecoveryInformation, RecoveringInternalEnlistment internalEnlistment)13         internal IPromotedEnlistment ReenlistTransaction(Guid resourceManagerIdentifier, byte[] resourceManagerRecoveryInformation, RecoveringInternalEnlistment internalEnlistment)
14         {
15             throw DistributedTransaction.NotSupported();
16         }
17 
CreateTransaction(TransactionOptions options)18         internal DistributedCommittableTransaction CreateTransaction(TransactionOptions options)
19         {
20             throw DistributedTransaction.NotSupported();
21         }
22 
ResourceManagerRecoveryComplete(Guid resourceManagerIdentifier)23         internal void ResourceManagerRecoveryComplete(Guid resourceManagerIdentifier)
24         {
25             throw DistributedTransaction.NotSupported();
26         }
27 
GetWhereabouts()28         internal byte[] GetWhereabouts()
29         {
30             throw DistributedTransaction.NotSupported();
31         }
32 
GetTransactionFromDtcTransaction(IDtcTransaction transactionNative)33         internal static Transaction GetTransactionFromDtcTransaction(IDtcTransaction transactionNative)
34         {
35             throw DistributedTransaction.NotSupported();
36         }
37 
GetTransactionFromExportCookie(byte[] cookie, Guid txId)38         internal static DistributedTransaction GetTransactionFromExportCookie(byte[] cookie, Guid txId)
39         {
40             throw DistributedTransaction.NotSupported();
41         }
42 
GetDistributedTransactionFromTransmitterPropagationToken(byte[] propagationToken)43         internal static DistributedTransaction GetDistributedTransactionFromTransmitterPropagationToken(byte[] propagationToken)
44         {
45             throw DistributedTransaction.NotSupported();
46         }
47     }
48 
49     /// <summary>
50     /// A Transaction object represents a single transaction.  It is created by TransactionManager
51     /// objects through CreateTransaction or through deserialization.  Alternatively, the static Create
52     /// methods provided, which creates a "default" TransactionManager and requests that it create
53     /// a new transaction with default values.  A transaction can only be committed by
54     /// the client application that created the transaction.  If a client application wishes to allow
55     /// access to the transaction by multiple threads, but wants to prevent those other threads from
56     /// committing the transaction, the application can make a "clone" of the transaction.  Transaction
57     /// clones have the same capabilities as the original transaction, except for the ability to commit
58     /// the transaction.
59     /// </summary>
60     [Serializable]
61     internal class DistributedTransaction : ISerializable, IObjectReference
62     {
DistributedTransaction()63         internal DistributedTransaction()
64         {
65         }
66 
DistributedTransaction(SerializationInfo serializationInfo, StreamingContext context)67         protected DistributedTransaction(SerializationInfo serializationInfo, StreamingContext context)
68         {
69             //if (serializationInfo == null)
70             //{
71             //    throw new ArgumentNullException(nameof(serializationInfo));
72             //}
73 
74             //throw NotSupported();
75             throw new PlatformNotSupportedException();
76         }
77 
78         internal Exception InnerException { get; set; }
79         internal Guid Identifier { get; set; }
80         internal RealDistributedTransaction RealTransaction { get; set; }
81         internal TransactionTraceIdentifier TransactionTraceId { get; set; }
82         internal IsolationLevel IsolationLevel { get; set; }
83         internal Transaction SavedLtmPromotedTransaction { get; set; }
84 
Dispose()85         internal void Dispose()
86         {
87         }
88 
EnlistVolatile(InternalEnlistment internalEnlistment, EnlistmentOptions enlistmentOptions)89         internal IPromotedEnlistment EnlistVolatile(InternalEnlistment internalEnlistment, EnlistmentOptions enlistmentOptions)
90         {
91             throw NotSupported();
92         }
93 
EnlistDurable(Guid resourceManagerIdentifier, DurableInternalEnlistment internalEnlistment, bool v, EnlistmentOptions enlistmentOptions)94         internal IPromotedEnlistment EnlistDurable(Guid resourceManagerIdentifier, DurableInternalEnlistment internalEnlistment, bool v, EnlistmentOptions enlistmentOptions)
95         {
96             throw NotSupported();
97         }
98 
Rollback()99         internal void Rollback()
100         {
101             throw NotSupported();
102         }
103 
DependentClone(bool v)104         internal DistributedDependentTransaction DependentClone(bool v)
105         {
106             throw NotSupported();
107         }
108 
EnlistVolatile(VolatileDemultiplexer volatileDemux, EnlistmentOptions enlistmentOptions)109         internal IPromotedEnlistment EnlistVolatile(VolatileDemultiplexer volatileDemux, EnlistmentOptions enlistmentOptions)
110         {
111             throw NotSupported();
112         }
113 
GetExportCookie(byte[] whereaboutsCopy)114         internal byte[] GetExportCookie(byte[] whereaboutsCopy)
115         {
116             throw NotSupported();
117         }
118 
GetRealObject(StreamingContext context)119         public object GetRealObject(StreamingContext context)
120         {
121             throw NotSupported();
122         }
123 
GetTransmitterPropagationToken()124         internal byte[] GetTransmitterPropagationToken()
125         {
126             throw NotSupported();
127         }
128 
GetDtcTransaction()129         internal IDtcTransaction GetDtcTransaction()
130         {
131             throw NotSupported();
132         }
133 
ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext context)134         void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext context)
135         {
136             //if (serializationInfo == null)
137             //{
138             //    throw new ArgumentNullException(nameof(serializationInfo));
139             //}
140 
141             //throw NotSupported();
142 
143             throw new PlatformNotSupportedException();
144         }
145 
NotSupported()146         internal static Exception NotSupported()
147         {
148             return new PlatformNotSupportedException(SR.DistributedNotSupported);
149         }
150 
151         [Serializable]
152         internal class RealDistributedTransaction
153         {
154             internal InternalTransaction InternalTransaction { get; set; }
155         }
156     }
157 
158     [Serializable]
159     internal class DistributedDependentTransaction : DistributedTransaction
160     {
Complete()161         internal void Complete()
162         {
163             throw NotSupported();
164         }
165     }
166 
167     [Serializable]
168     internal class DistributedCommittableTransaction : DistributedTransaction
169     {
BeginCommit(InternalTransaction tx)170         internal void BeginCommit(InternalTransaction tx)
171         {
172             throw NotSupported();
173         }
174     }
175 }
176