Cannot Translate to SQL using Select(x => Func(x))
Posted
by Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2010-03-31T22:03:05Z
Indexed on
2010/03/31
22:13 UTC
Read the original article
Hit count: 281
I'm slowly learning the ins and outs of LINQtoSQL, but this is confusing me.
Here is the statement I have:
IQueryable<IEvent> events = (from e in db.getEvents()
select e).Select(x => SelectEvent(x, null));
What the SelectEvent does can be explained in this answer here. I am not using the .toList() function as I don't want potentially thousands of records brought into memory.
public IEvent SelectEvent(SqlServer.Event ev, EventType? type) {
// Create an object which implements IEvent
// I don't have the code in front of me, so forgive the lack of code
}
My question is really for the Select()
method. I get the "Cannot translate to SQL" error and the Select()
is listed in the error message.
Clueless on this one :-/.
© Stack Overflow or respective owner