/// <summary> /// Clean up the database /// </summary> /// <param name="dbName">e.g NorthWind</param> /// <param name="dbProvider">e.g. TestDatabaseProviders.SQL2000, TestDatabaseProviders.SQL2005</param> /// <param name="dbSrvLang">e.g. English, Japanese (Read from DlinqServers.xml)</param> /// <param name="dbSrvType">e.g. AMD64, x86, IA64, etc</param> /// <param name="dbSrvOS">e.g. Win2003, WinXP, etc</param> public static void CleanDB(string dbName, TestDatabaseProviderInfo dbProvider, string dbSrvLang, string dbSrvType, string dbSQLSrvLang, string dbSrvOS) { List <DictionaryEntry> Ls = new List <DictionaryEntry>(); Ls.Add(new DictionaryEntry("DbProvider", dbProvider.Name)); Ls.Add(new DictionaryEntry("DbSrvLang", dbSrvLang)); Ls.Add(new DictionaryEntry("DbSQLSrvLang", dbSQLSrvLang)); Ls.Add(new DictionaryEntry("DbSrvOS", dbSrvOS)); Ls.Add(new DictionaryEntry("DbSrvType", dbSrvType)); CleanDB(dbName, Ls); }
/// <summary> /// Clean up the database /// </summary> /// <param name="dbName">e.g NorthWind</param> /// <param name="dbProvider">e.g. SQL2000, SQL2005 or DatabaseFile (Read from DlinqServers.xml)</param> /// <param name="dbSrvLang">e.g. English, Japanese (Read from DlinqServers.xml)</param> /// <param name="dbSrvType">e.g. AMD64, x86, IA64, etc</param> /// <param name="dbSrvOS">e.g. Win2003, WinXP, etc</param> public static string GetConnectionStringForReadOnlyDatabase(string dbName, TestDatabaseProviderInfo dbProvider, string dbSrvLang, string dbSrvType, string dbSQLSrvLang, string dbSrvOS) { List <DictionaryEntry> Ls = new List <DictionaryEntry>(); Ls.Add(new DictionaryEntry("DbProvider", dbProvider.Name)); Ls.Add(new DictionaryEntry("DbSrvLang", dbSrvLang)); Ls.Add(new DictionaryEntry("DbSQLSrvLang", dbSQLSrvLang)); Ls.Add(new DictionaryEntry("DbSrvOS", dbSrvOS)); Ls.Add(new DictionaryEntry("DbSrvType", dbSrvType)); return(GetConnectionStringForReadOnlyDatabase(dbName, Ls)); }
public static void DeleteDatabase(string dbName, TestDatabaseProviderInfo provider) { using (SqlConnection sqlcon = new SqlConnection(GetAdminConnectionString("Master", provider))) { SqlCommand sqlcom = new SqlCommand("dbi_DeleteDatabase", sqlcon); sqlcom.CommandType = System.Data.CommandType.StoredProcedure; sqlcom.Parameters.AddWithValue("@DBName", dbName); sqlcom.Connection.Open(); sqlcom.ExecuteNonQuery(); sqlcom.Connection.Close(); SqlConnection.ClearAllPools(); } }
public static void CleanDB(string dbName, TestDatabaseProviderInfo provider) { dbName = GetNewDBName(dbName); try { DeleteDatabase(dbName, provider); } catch (Exception ex) { // should this be an assert? Console.WriteLine("Failed to remove database : " + ex.Message); } }
public static string GetDefaultServerLocation(TestDatabaseProviderInfo dbProvider) { return(dbProvider.Location); }
/// <summary> /// Read the Server Name from the DomainServices.xml file /// </summary> /// <param name="dbProvider">e.g. SQL2000, SQL2005</param> /// <param name="dbLang">e.g. English, Japanese</param> /// <returns></returns> public static string GetServerLocation(TestDatabaseProviderInfo dbProvider, string dbSrvLang) { return(GetServerLocation(dbProvider.Name, dbSrvLang)); }
public static string GetServerPath(TestDatabaseProviderInfo provider, string fileName) { return(Path.Combine(provider.DataFilePath, fileName)); }
private static string GetAdminConnectionString(string dbName, TestDatabaseProviderInfo provider) { return("Server=" + provider.Location + ";Database=" + dbName + ";User=RiaTest;Password=TestPassword"); }
public static string GetConnectionString(string dbName, TestDatabaseProviderInfo dbProvider, AccessMode accessMode) { return(GetConnectionString(dbName, dbProvider, null, null, null, null, accessMode)); }
public static string GetDefaultServerDataFilePath(TestDatabaseProviderInfo provider) { return(provider.DataFilePath); }
/// <summary> /// Get the Server DataFilePath /// </summary> /// <param name="dbProvider">e.g. SQL2000, SQL2005</param> /// <param name="dbLang">e.g. English, Japanese</param> /// <returns></returns> public static string GetServerDataFilePath(TestDatabaseProviderInfo dbProvider, string dbSrvLang) { return(GetServerDataFilePath(dbProvider.Name, dbSrvLang)); }
public static string GetDefaultServerCredentials(TestDatabaseProviderInfo provider) { return(provider.Credentials); }
/// <summary> /// Get the Server Credentials /// </summary> /// <param name="dbProvider">e.g. SQL2000, SQL2005</param> /// <param name="dbLang">e.g. English, Japanese</param> /// <returns></returns> public static string GetServerCredentials(TestDatabaseProviderInfo dbProvider, string dbSrvLang) { return(GetServerCredentials(dbProvider.Name, dbSrvLang)); }
public static string GetServerConnectionString(TestDatabaseProviderInfo provider) { return(String.Format(@"Server={0};{1}", provider.Location, provider.Credentials)); }