I have this ExecuteUpdate
call below inside a for loop and I want to know if it’s possible to eliminate the for loop? I know I can use a list in the where clause for all the UserIds but I’m not sure about the SetProperty
foreach(var registrant in yogabandEvent.Registrants) {
result = await _dbContext.Users
.Where(p => p.Id == registrant.UserId)
.ExecuteUpdateAsync(setters => setters
.SetProperty(p => p.Attended, registrant.RegistrantType == RegistrantType.Student ? p => p.Attended + 1 : p => p.Attended)
);
}