Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

EF Core 7 no definition for ExecuteUpdateAsync

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading