views:

40

answers:

1

According to this article you are suppose to be able to do includes using a lambda expression http://romiller.com/2010/07/14/ef-ctp4-tips-tricks-include-with-lambda/.

For example ...

var blogsWithPosts = context.Blogs.Include(b => b.Posts);

So where I have ...

IQueryable<Data.Patient> query = ctx.ObjectContext.Patients
                    .Include("Person");

I would like to have it be ...

 IQueryable<Data.Patient> query = ctx.ObjectContext.Patients
                    .Include(row => row.Person);

I added the imports for System.Data.Entity ... but still can't make it happen. I am using Csla, so my context object is set like ...

using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>.GetManager(Database.ApplicationConnection, false))
 {
 }

That may be the problem ... any help would be much appreciated!

+3  A: 

This is not an overload of the standard ObjectQuery<T>.Include Method and is merely an extension method on ObjectQuery<T> Class coming with EF CTP4.
In order to use Include method with lambda you need to download ADO.NET Entity Framework Feature Community Technology Preview 4 and then add a reference to Microsoft.Data.Entity.Ctp.dll coming with it.

Morteza Manavi
Silly question ... bust is the CTP4 no included with VS 2010? If not ... where can I snag it from?
mattruma
mattruma
Morteza Manavi