Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
        /// <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));
        }
Esempio n. 3
0
 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();
     }
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
 public static string GetDefaultServerLocation(TestDatabaseProviderInfo dbProvider)
 {
     return(dbProvider.Location);
 }
Esempio n. 6
0
 /// <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));
 }
Esempio n. 7
0
 public static string GetServerPath(TestDatabaseProviderInfo provider, string fileName)
 {
     return(Path.Combine(provider.DataFilePath, fileName));
 }
Esempio n. 8
0
 private static string GetAdminConnectionString(string dbName, TestDatabaseProviderInfo provider)
 {
     return("Server=" + provider.Location + ";Database=" + dbName + ";User=RiaTest;Password=TestPassword");
 }
Esempio n. 9
0
 public static string GetConnectionString(string dbName, TestDatabaseProviderInfo dbProvider, AccessMode accessMode)
 {
     return(GetConnectionString(dbName, dbProvider, null, null, null, null, accessMode));
 }
Esempio n. 10
0
 public static string GetDefaultServerDataFilePath(TestDatabaseProviderInfo provider)
 {
     return(provider.DataFilePath);
 }
Esempio n. 11
0
 /// <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));
 }
Esempio n. 12
0
 public static string GetDefaultServerCredentials(TestDatabaseProviderInfo provider)
 {
     return(provider.Credentials);
 }
Esempio n. 13
0
 /// <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));
 }
Esempio n. 14
0
 public static string GetServerConnectionString(TestDatabaseProviderInfo provider)
 {
     return(String.Format(@"Server={0};{1}", provider.Location, provider.Credentials));
 }