2 // CommittableTransaction.cs
5 // Atsushi Enomoto <atsushi@ximian.com>
11 using System.Runtime.Serialization;
12 using System.Threading;
14 namespace System.Transactions
17 public sealed class CommittableTransaction : Transaction,
18 ISerializable, IDisposable, IAsyncResult
21 TransactionOptions options;
22 AsyncCallback callback;
23 object user_defined_state;
27 public CommittableTransaction ()
28 : this (new TransactionOptions ())
32 public CommittableTransaction (TimeSpan timeout)
34 options = new TransactionOptions ();
35 options.Timeout = timeout;
38 public CommittableTransaction (TransactionOptions options)
40 this.options = options;
44 public IAsyncResult BeginCommit (AsyncCallback callback,
45 object user_defined_state)
48 throw new InvalidOperationException ();
49 this.committing = true;
50 this.callback = callback;
51 this.user_defined_state = user_defined_state;
52 // FIXME: invoke another thread and set WaitHandle.
58 EndCommit (BeginCommit (null, null));
62 public void EndCommit (IAsyncResult asyncResult)
64 if (asyncResult != this)
65 throw new InvalidOperationException ();
66 throw new NotImplementedException ();
70 void ISerializable.GetObjectData (SerializationInfo info,
71 StreamingContext context)
73 throw new NotImplementedException ();
76 object IAsyncResult.AsyncState {
77 get { return user_defined_state; }
81 WaitHandle IAsyncResult.AsyncWaitHandle {
82 get { throw new NotImplementedException (); }
86 bool IAsyncResult.CompletedSynchronously {
87 get { throw new NotImplementedException (); }
90 bool IAsyncResult.IsCompleted {
91 get { return completed; }