Drop this one too
[mono.git] / mcs / class / System.Transactions / System.Transactions / Transaction.cs
index 07cff16e00729ce45422516b13baed119c89deec..dc132fb4a045f13fba28834eb35e578b7e91f1dc 100644 (file)
@@ -21,6 +21,7 @@ namespace System.Transactions
        [Serializable]
        public class Transaction : IDisposable, ISerializable
        {
+               [ThreadStatic]
                static Transaction ambient;
 
                IsolationLevel level;
@@ -100,16 +101,15 @@ namespace System.Transactions
                        }
                }
 
-               [MonoTODO]
                public Transaction Clone ()
                {
                        return new Transaction (this);
                }
 
-               [MonoTODO]
                public void Dispose ()
                {
-                       throw new NotImplementedException ();
+                       if (TransactionInformation.Status == TransactionStatus.Active)
+                               Rollback();
                }
 
                [MonoTODO]
@@ -122,7 +122,7 @@ namespace System.Transactions
                        return d;
                }
 
-               [MonoTODO]
+               [MonoTODO ("Only SinglePhase commit supported for durable resource managers.")]
                [PermissionSetAttribute (SecurityAction.LinkDemand)]
                public Enlistment EnlistDurable (Guid manager,
                        IEnlistmentNotification notification,
@@ -131,7 +131,7 @@ namespace System.Transactions
                        throw new NotImplementedException ("Only SinglePhase commit supported for durable resource managers.");
                }
 
-               [MonoTODO]
+               [MonoTODO ("Only Local Transaction Manager supported. Cannot have more than 1 durable resource per transaction. Only EnlistmentOptions.None supported yet.")]
                [PermissionSetAttribute (SecurityAction.LinkDemand)]
                public Enlistment EnlistDurable (Guid manager,
                        ISinglePhaseNotification notification,
@@ -158,7 +158,7 @@ namespace System.Transactions
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
+               [MonoTODO ("EnlistmentOptions being ignored")]
                public Enlistment EnlistVolatile (
                        IEnlistmentNotification notification,
                        EnlistmentOptions options)
@@ -166,7 +166,7 @@ namespace System.Transactions
                        return EnlistVolatileInternal (notification, options);
                }
 
-               [MonoTODO]
+               [MonoTODO ("EnlistmentOptions being ignored")]
                public Enlistment EnlistVolatile (
                        ISinglePhaseNotification notification,
                        EnlistmentOptions options)
@@ -186,26 +186,33 @@ namespace System.Transactions
                        /* FIXME: Enlistment.. ? */
                        return new Enlistment ();
                }
-                               
-               [MonoTODO]
+
                public override bool Equals (object obj)
                {
-                       Transaction t = obj as Transaction;
-                       if (t == null)
+                       return Equals (obj as Transaction);
+               }
+
+               // FIXME: Check whether this is correct (currently, GetHashCode() uses 'dependents' but this doesn't)
+               private bool Equals (Transaction t)
+               {
+                       if (ReferenceEquals (t, this))
+                               return true;
+                       if (ReferenceEquals (t, null))
                                return false;
                        return this.level == t.level &&
                                this.info == t.info;
                }
 
-               [MonoTODO]
-               public static bool op_Inequality (Transaction x, Transaction y)
+               public static bool operator == (Transaction x, Transaction y)
                {
-                       if (x == null && y == null)
-                               return false;
-                       if (x == null || y == null)
-                               return true;
+                       if (ReferenceEquals (x, null))
+                               return ReferenceEquals (y, null);
+                       return x.Equals (y);
+               }
 
-                       return ! x.Equals (y);
+               public static bool operator != (Transaction x, Transaction y)
+               {
+                       return !(x == y);
                }
 
                public override int GetHashCode ()