I want to write a query that the user object should receive and the number of messages that the user has already posted. I did it as follows:
var query = (from u in _db.Repository<User>()
where u.IsDeleted != true
select new UserWithMessagecount()
{
User = u
MessageCount = GetUserMessageCount(u.Documents).Count(),
});
I use the method because some messages need to be filtered out (in a dynamic way) .
To keep things simple, I will post a function without sorting logic (which still causes the same error).
private EntitySet<Document> GetUserMessageCount(EntitySet<Document> set)
{
return set;
}
Error returned:
The 'x' method does not support SQL translation.
Any ideas on how to fix this?
source
share