Пример #1
0
 public static bool TestDB(string connString)
 {
     bool r = false;
     using (var db = new  DB())
     {
         db.Database.Connection.ConnectionString = connString;
         try
         {
             db.Database.Connection.Open();
             r = (db.Database.Connection.State == ConnectionState.Open);
         }
         catch(Exception ee)
         {
             System.Windows.Forms.MessageBox.Show(ee.Message);
             r = false;
         }
     }
     return r;
 }
Пример #2
0
        public static DB getDB(int timeOut)
        {
            /*
            if (!System.IO.File.Exists("config.ini"))
            {
                FDatabase m = new FDatabase();
                m.ShowDialog();
            }*/

            var db = new DB();
            db.Database.Connection.ConnectionString = getIniConn("config.ini", timeOut);
            db.Configuration.EnsureTransactionsForFunctionsAndCommands = true;
            return db;
        }