Я действительно озадачен этим. Я пытаюсь передать мой сообщений vaiable к методу. Как идти об этом:Linq to Entities: Как передать IQueryable методу
var posts = from p in context.post
where (p.post_isdeleted == false && (object.Equals(p.post_parentid, null))
select new
{
p.post_date,
p.post_id,
FavoriteCount = (from f in context.favorites
where f.post.post_id == p.post_id
select new { f }).Count()
};
posts = QuestionList.FilterQuestion(posts, sort);
//the problem is here
//IQueryable is not the right type for posts. What type do I put in there
private static IQueryable FilterQuestion(IQueryable p, string sort)
{
Возможно, запрос Linq может быть несколько упрощен. Например, 'FavoriteCount = p.post.favorites.count()', если ваша объектная модель настроена правильно. –