Je suis vraiment déconcerté sur celui-ci. J'essaie de passer mes postes vaiable à une méthode. Comment puis-je à faire ceci:Linq to Entities: Comment puis-je passer un IQueryable à une méthode
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)
{
La requête Linq pourrait probablement être simplifiée quelque peu. Par exemple, 'FavoriteCount = p.post.favorites.count()' si votre modèle d'objet est configuré correctement. –