private static async Task TryBackup(DalContext context, string dbPath) { try { var backupConnection = new SqliteConnection($"{dbPath}.{DateTime.Now:yyyy-MM-dd--HH-mm-ss}.backup"); await backupConnection.OpenAsync(); var dbConnection = ((SqliteConnection)context.Database.GetDbConnection()); await dbConnection.OpenAsync(); dbConnection.BackupDatabase(backupConnection); backupConnection.Close(); dbConnection.Close(); } catch (Exception e) { Console.WriteLine(e); throw; } }