예제 #1
0
        public virtual IDb OpenDb(IDbConnection cn)
        {
            LitDb db = new LitDb(this, cn);

            db.IsAdapter = true;
            return(db);
        }
예제 #2
0
        public virtual IDb OpenDb()
        {
            IDbConnection cn = new SQLiteConnection(connString);
            //cn.Open();
            IDb db = new LitDb(this, cn);

            return(db);
        }
예제 #3
0
 public virtual void CloseDb(LitDb db)
 {
     if (!db.IsClosed)
     {
         if (!db.IsAdapter && db.Connection != null)
         {
             SQLiteConnection cn = (SQLiteConnection)db.Connection;
             if (cn.State != ConnectionState.Closed)
             {
                 cn.Close();
             }
             cn.Dispose();
             db.Connection = null;
         }
     }
 }
예제 #4
0
 public virtual void OpenDb(LitDb db)
 {
     if (db.IsClosed)
     {
         if (db.Connection == null)
         {
             db.Connection = new SQLiteConnection(connString);
             db.Connection.Open();
         }
         else
         {
             if (db.Connection.State == ConnectionState.Closed)
             {
                 db.Connection.Open();
             }
         }
     }
 }