EF 4.1 - DBContext SqlQuery and Include
问题 I want to execute a raw sql using DBContext SqlQuery and then include related entites. I've tried the following but it doesn't load the related entities: string sql = "Select * from client where id in (select id from activeclient)"; var list = DbContext.Database.SqlQuery<Client>(sql).AsQueryable().Include(c => c.Address).Include(c => c.Contactinfo).ToList(); Any help? 回答1: It is not possible. Include works only with ESQL or linq-to-entities because it must be processed during query building