Changeset 2095 for trunk/sources
- Timestamp:
- 06/25/09 12:48:29 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/Session.cs
r1529 r2095 42 42 private Thread ownerThread; 43 43 44 private int counter; 45 44 46 private IDictionary<Guid, object> adapters = 45 47 new Dictionary<Guid, object>(); … … 48 50 this.factory = factory; 49 51 this.ownerThread = Thread.CurrentThread; 52 this.counter = 0; 50 53 } 51 54 … … 68 71 public void DetachTrasaction() { 69 72 this.transaction = null; 73 } 74 75 public void IncrementCounter() { 76 this.counter++; 70 77 } 71 78 … … 127 134 128 135 public void EndSession() { 129 CheckThread();136 this.counter--; 130 137 131 if (transaction != null) { 132 transaction.Rollback(); 133 transaction = null; 138 if (counter <= 0) { 139 CheckThread(); 140 141 if (transaction != null) { 142 transaction.Rollback(); 143 transaction = null; 144 } 145 if (connection.State == System.Data.ConnectionState.Open) { 146 connection.Close(); 147 connection = null; 148 } 149 factory.EndSession(this); 134 150 } 135 if (connection.State == System.Data.ConnectionState.Open) {136 connection.Close();137 connection = null;138 }139 factory.EndSession(this);140 151 } 141 152 -
trunk/sources/HeuristicLab.DataAccess.ADOHelper/3.2/SessionFactory.cs
r1529 r2095 31 31 namespace HeuristicLab.DataAccess.ADOHelper { 32 32 public class SessionFactory: ISessionFactory { 33 private IDictionary<Thread, ISession> sessions =34 new Dictionary<Thread, ISession>();33 private IDictionary<Thread, Session> sessions = 34 new Dictionary<Thread, Session>(); 35 35 36 36 public Type DbConnectionType { get; set; } … … 86 86 } 87 87 88 sessions[current].IncrementCounter(); 89 88 90 return sessions[current]; 89 91 }
Note: See TracChangeset
for help on using the changeset viewer.