Changeset 1110 for trunk/sources/HeuristicLab.Grid/Database.cs
 Timestamp:
 01/12/09 10:39:15 (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/sources/HeuristicLab.Grid/Database.cs
r507 r1110 25 25 using System.Text; 26 26 using System.Data; 27 using System.Data.SQLite;28 27 using System.Data.Common; 29 28 using System.Threading; … … 33 32 private string connectionString; 34 33 private ReaderWriterLockSlim rwLock; 34 private DbProviderFactory factory; 35 35 public Database(string connectionString) { 36 36 this.connectionString = connectionString; 37 37 rwLock = new ReaderWriterLockSlim(); 38 factory = DbProviderFactories.GetFactory("System.Data.SQLite"); 38 39 } 39 40 … … 42 43 rwLock.EnterWriteLock(); 43 44 try { 44 using(DbConnection cnn = new SQLiteConnection(connectionString)) { 45 using (DbConnection cnn = factory.CreateConnection()) { 46 cnn.ConnectionString = connectionString; 45 47 cnn.Open(); 46 48 using(DbTransaction t = cnn.BeginTransaction()) { … … 62 64 rwLock.EnterWriteLock(); 63 65 try { 64 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 66 using (DbConnection cnn = factory.CreateConnection()) { 67 cnn.ConnectionString = connectionString; 65 68 cnn.Open(); 66 69 using(DbTransaction t = cnn.BeginTransaction()) { … … 104 107 rwLock.EnterUpgradeableReadLock(); 105 108 try { 106 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 109 using (DbConnection cnn = factory.CreateConnection()) { 110 cnn.ConnectionString = connectionString; 107 111 cnn.Open(); 108 112 JobEntry job = new JobEntry(); … … 159 163 rwLock.EnterWriteLock(); 160 164 try { 161 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 165 using (DbConnection cnn = factory.CreateConnection()) { 166 cnn.ConnectionString = connectionString; 162 167 cnn.Open(); 163 168 using(DbTransaction t = cnn.BeginTransaction()) { … … 190 195 rwLock.EnterWriteLock(); 191 196 try { 192 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 197 using (DbConnection cnn = factory.CreateConnection()) { 198 cnn.ConnectionString = connectionString; 193 199 cnn.Open(); 194 200 using(DbTransaction t = cnn.BeginTransaction()) { … … 225 231 rwLock.EnterReadLock(); 226 232 try { 227 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 233 using (DbConnection cnn = factory.CreateConnection()) { 234 cnn.ConnectionString = connectionString; 228 235 cnn.Open(); 229 236 DbCommand c = cnn.CreateCommand(); … … 255 262 rwLock.EnterReadLock(); 256 263 try { 257 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 264 using (DbConnection cnn = factory.CreateConnection()) { 265 cnn.ConnectionString = connectionString; 258 266 cnn.Open(); 259 267 DbCommand c = cnn.CreateCommand(); … … 279 287 rwLock.EnterReadLock(); 280 288 try { 281 using(SQLiteConnection cnn = new SQLiteConnection(connectionString)) { 289 using (DbConnection cnn = factory.CreateConnection()) { 290 cnn.ConnectionString = connectionString; 282 291 cnn.Open(); 283 292 DbCommand c = cnn.CreateCommand();
Note: See TracChangeset
for help on using the changeset viewer.