Hi folks,
I have a very simple repository I'm playing around with, using Entity Framework v4 that comes with VS2010 Beta 2.
I'm trying to dynamically include the Include method, if a user optionally asks for it.
eg.
Public IQueryable<Foo> GetFoos(bool includeBars)
{
var entites = new Entities("... connection string ... ");
var query = from q in entities.Foos
select q;
if (includeBars)
{
// THIS IS THE PART I'M STUCK ON.
// eg. query = from q in query.Include("Bars") select q;
}
return (from q in query
select new Core.Foo
{
FooId = q.FooId,
CreatedOn = q.CreatedOn
});
}
Can anyone please help?