I am trying to reuse part of the request because it is complex enough so that I try to avoid code duplication.
It seems that when you call any method inside the request, you get:
LINQ to Entities does not recognize the method of the {X} method and this method cannot be translated.
Ideally, I would like to use:
var q = from item in context.Items where item.SomeCondition == true select new {Item = item, Connections = GetConnections(item)};
GetConnections is a method that executes requests for item . I'm trying to reuse a (rather complicated) request in GetConnections , but I'm not sure how to make this work.
The current GetConnections signature looks something like this:
IQuerable<Connection> GetConnections(MyItem item)
c # linq linq-to-entities entity-framework entity-framework-4
Sander rijken
source share