Changeset 3970 for branches/HeuristicLab.Services.Authentication Prototype/Persistence/DatabaseUtil.cs
- Timestamp:
- 06/28/10 18:28:12 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/Persistence/DatabaseUtil.cs
r3955 r3970 1 1 using System; 2 using System.Diagnostics; 2 3 3 4 namespace Persistence { … … 6 7 /// </summary> 7 8 public class DatabaseUtil { 9 10 protected static bool productionDatabase = true; 11 12 public static bool ProductionDatabase { 13 get { 14 return DatabaseUtil.productionDatabase; 15 } 16 set { 17 DatabaseUtil.productionDatabase = value; 18 } 19 } 20 8 21 /// <summary> 9 22 /// creates and returns a database connection, if possible … … 11 24 /// <returns>database connection (could be null)</returns> 12 25 public static DataClassesDataContext createDataClassesDataContext() { 13 return new Persistence.DataClassesDataContext(@"C:\TEMP\HeuristicLabTest.mdf"); 26 if (productionDatabase) { 27 return new Persistence.DataClassesDataContext(new Persistence.Properties.Settings().DatabaseConnectionString); 28 } else { 29 return new Persistence.DataClassesDataContext(new Persistence.Properties.Settings().DatabaseConnectionStringTesting); 30 } 14 31 } 15 32 … … 19 36 /// <param name="db">DataClassesDataContext</param> 20 37 public static void createDatabase(DataClassesDataContext db) { 21 if (db == null) { 22 throw new ArgumentNullException("db"); 23 } 24 38 25 39 if (db.DatabaseExists()) { 26 40 Console.WriteLine("Deleting old database...");
Note: See TracChangeset
for help on using the changeset viewer.