private void UpsertProcessManager(T processManager) { if (_dbContext.Entry(processManager).State == EntityState.Detached) { _dbContext.Set <T>().Add(processManager); } }
private static async Task RemoveScheduledCommand( ProcessManagerDbContext dbContext, PendingScheduledCommand scheduledCommand, CancellationToken cancellationToken) { try { dbContext.PendingScheduledCommands.Remove(scheduledCommand); await dbContext.SaveChangesAsync(cancellationToken).ConfigureAwait(false); } catch (DbUpdateConcurrencyException) { dbContext.Entry(scheduledCommand).State = EntityState.Detached; } }