Esempio n. 1
0
 public SqliteDataPersistenceLayer(string dbFilePath)
 {
     if (string.IsNullOrWhiteSpace(dbFilePath))
     {
         throw new ArgumentException($"Argument {nameof(dbFilePath)} cannot be null, empty or whitespace.");
     }
     _dbFilePath = dbFilePath;
     _dataClient = new SqliteDataClient(_dbFilePath);
 }
        private void PrepareDatabase()
        {
            if (!File.Exists(_dbFilePath))
            {
                SQLiteConnection.CreateFile(_dbFilePath);

                try
                {
                    using (SQLiteConnection conn = SqliteDataClient.OpenConnection(_connectionString))
                    {
                        ExecuteNonQuery(conn, SqlStrings.CreateTable);
                    }
                }
                catch
                {
                    File.Delete(_dbFilePath);
                }
            }
        }
Esempio n. 3
0
 public void Dispose()
 {
     _dataClient.Dispose();
     _dataClient = null;
 }