Alexandre Blecich
Alexandre Blecich

Reputation: 75

Entity Framework Core ObjectContext.Refresh equivalence

With Entity Framework 6, it was possible to refresh all the context with the method : _myObjectContext.RefreshAsync(RefreshMode.StoreWins, GetAll())

I would like to do the same thing with Entity Framework Core, but I can't find the best way to do that.

So, what's the best way to refresh all the context with EF Core?

Upvotes: 2

Views: 2065

Answers (1)

Vivek Nuna
Vivek Nuna

Reputation: 1

There isn't currently an equivalent in EF Core. context.Entry(foo).Reload() is currently the closest thing, but it only works on a single entity.

In general, we recommend using short-lived contexts that cover a single unit-of-work. This usually makes reloading from the store unnecessary.

You can track the issue here.

Upvotes: 4

Related Questions