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); } } }
public void Dispose() { _dataClient.Dispose(); _dataClient = null; }