How do I write this as an expression?

Posted by itchi on Stack Overflow See other posts from Stack Overflow or by itchi
Published on 2010-03-12T01:42:02Z Indexed on 2010/03/12 1:47 UTC
Read the original article Hit count: 355

I'm trying to rewrite a linq to entities query to an expression. My model is a School can have many Persons where Persons are inherited out to teachers, students, etc.

The following query works for me:

IQueryable<DAL.TEACHER> teacher = from p in School select p.PERSON as ESBDAL.TEACHER;

How would I write this as a query expression? I thought something like:

IQueryable<DAL.TEACHER> teacher = School.Select(x=>x.PERSON) as IQueryable<DAL.TEACHER>;

...but it does not. Am I misunderstanding the .Select()?

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about entity-framework