I am relatively new to LINQ-to-Entities, but use LINQ-to-SQL a lot.
I am using Visual Studio 2013 with Entity Framework 6 and MVC 5.
The biggest difference b
I know I'm a little late to the party but for anyone doing a Google search:
I had this problem and it turns out the class the DbFunctionAttribute is on has to have the same namespace as the edmx schema.
So in this case either change the edmx schema namespace to BillYeagerDB,
or change the EdmxExtensionMethods namespace to BillYeagerModel
try to rewrite your select method to this:
var restaurants = await DbContext.Restaurants.GroupBy(g => g).ToListAsync();
return restaurants.Select(s =>
new RestaurantList()
{
Name = s.Key.Name,
City = s.Key.City,
Phone = s.Key.Phone,
AvgRating = s.Average(a => Convert.ToDecimal(a.Rating.RatingValue)),
NbrOfPeopleRating = s.Distinct().Count(c => Convert.ToBoolean(c.RatingId)),
Id = s.Key.Id
});