4

I have the following query in my project which is using Microsoft.EntityFrameworkCore 7.0.2:

await _context.Actions
    .Where(a => a.DateCreated < DateTime.Today && a.ActionType == (int)ActionTypes.ScoredAction && !a.DateCompleted.HasValue)
    .ExecuteUpdateAsync(b => b
        .SetProperty(x => x.DateCompleted, x => DateTime.Today)
        .SetProperty(x => x.ActionResultType, x => LeadScoringConstants.SystemClosed));

But when I try to build, it's saying that IQueryable<ActionEntity> doesn't contain a definition for ExecuteUpdateAsync. Am I missing something here as the documentation says it was added to EF Core 7

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
Pete
  • 57,112
  • 28
  • 117
  • 166

1 Answers1

4

ExecuteUpdateAsync is part of the RelationalQueryableExtensions, do not forget to install corresponding nuget (i.e. Microsoft.EntityFrameworkCore.Relational).

Guru Stron
  • 102,774
  • 10
  • 95
  • 132