public async Task AddAsync(ITransfer model) { using (var context = _contextFactory.CreateDataContext()) { var entity = TransferEventDataEntity.Create(model); await context.TransferEventsData.AddAsync(entity); try { await context.SaveChangesAsync(); } catch (DbUpdateException e) { if (e.InnerException is SqlException sqlException && sqlException.Number == MsSqlErrorCodes.PrimaryKeyConstraintViolation) { _log.Warning("Error on transfer event context saving", e); }
public async Task AddAsync(ITransfer model) { using (var context = _contextFactory.CreateDataContext()) { var entity = TransferEventDataEntity.Create(model); await context.TransferEventsData.AddAsync(entity); try { await context.SaveChangesAsync(); } catch (DbUpdateException e) { if (e.InnerException is PostgresException sqlException && sqlException.SqlState == PostgresErrorCodes.UniqueViolation) { _log.Warning("Error on transfer event context saving", e); }