I'm trying to execute following query with EF 4.0:
IQueryable<FeedItem> result =
from feedItem in database.FeedItems
where
user.SubscriptionsToMessageGroup.Contains(feedItem.RelatedMessage.MessageGroup) &&
feedItem.Id >= startFromId && feedItem.Id <= endAtId
select feedItem;
Variable named 'user' contains EF entity and SubscriptionsToMessageGroup is a relation.
When running this query, I've g开发者_JAVA百科ot an error "Unable to create a constant value of type MessageGroup. Only primitive types are supported in this context."
Can you please explain the problem and tell me if there is any way to achieve what I'm trying to do?
Referencing Non-Scalar Variables Not Supported in LINQ to Entities. Look for more information here and a possible similar problem here.
精彩评论