示例#1
0
        public VolumeDatabase(string dbPath, bool create)
        {
            if (dbPath == null)
            {
                throw new ArgumentNullException("dbPath");
            }

            disposed = false;
            sql      = new SqlBackend(dbPath, create, this);
            searchItemResultsLimit = -1;

            if (create)
            {
                CreateTables();
            }
            else
            {
                int version = GetDBProperties().Version;
                if (version != DB_VERSION)
                {
                    sql.Close();
                    throw new UnsupportedDbVersionException(string.Format("Found version {0}, expected version is {1}", version, DB_VERSION));
                }
            }
        }
示例#2
0
 private void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             if (!sql.IsClosed)
             {
                 sql.Close();
             }
         }
         sql = null;
     }
     disposed = true;
 }