score:0

Accepted answer

I was trying in EF 4.0 either we have write DB extentions for the same.

Option is provided in EF 4.1

http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/reading-related-data-with-the-entity-framework-in-an-asp-net-mvc-application

Thanks.

score:2

You can look at the Expression the compiler generates using IQueryable:

IQueryable<Employee> query = 
  from ee in entities.Employee ...

var expression = query.Expression;

Look at expression in a debugger to see what you need to generate - LINQPad is good for this.


You might want to simplify your query a bit first:

IQueryable<Employee> query = 
  from ee in entities.Employee.Include("EmpEduInfo")                           
  where
    ee.name.StartsWith("t") &&
    ee.EmpEduInfo.Any(x => x.name.StartsWith("t"))                             
  select ee;

Related Articles