private void SaveDtoToBackupRepository(object dtoInstance) { object existing = BackupRepository.Retrieve(dtoInstance.GetType(), dtoInstance.Property <string>("Uuid")); if (existing != null) { BackupRepository.Save(dtoInstance); } else { BackupRepository.Create(dtoInstance); } }
private void Backup(Database database, Dao dao) { if (database == SourceDatabase) { BackupTask = Task.Run(() => { object dtoInstance = Dto.Copy(dao); object existing = BackupRepository.Retrieve(dtoInstance.GetType(), dtoInstance.Property <string>("Uuid")); if (existing != null) { BackupRepository.Save(dtoInstance); } else { BackupRepository.Create(dtoInstance); } }); BackupTask.ConfigureAwait(false); } }