CMS
CMS

Reputation: 3757

Use 'Average()' On EF CORE (C# .NET CORE)

I use .NET CORE for a while now and i noticed that some queries run really strange, so i did some profiling and i noticed that some queries and running in parts on the database, instead of getting it in 1 shot. So i turned off the option 'QueryClientEvaluation' from EF core and i keep getting error

  The LINQ expression 'Average()' could not be translated and will be evaluated locally.

which is very strange because i used the Average function in EF6 till now with no issue, so why should it need to use QueryClientEvaluation??

here is a simple sample _context.Reviews.Select(r => r.Rating).Average()

Upvotes: 2

Views: 2067

Answers (1)

Masoud
Masoud

Reputation: 611

Which version are you using?

It was a bug #7190 that has been fixed at version 2.0.0-preview1. You can also have latest released version 2.0.0 .

Upvotes: 4

Related Questions