Print Page | Close Window

Using PathFor with Collections

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3450
Printed Date: 13-Apr-2026 at 4:57am


Topic: Using PathFor with Collections
Posted By: Walid
Subject: Using PathFor with Collections
Date Posted: 22-May-2012 at 1:45pm
Hi,

How to use Pathfor in this case :  Cutomers -> Orders -> OrderDetail. 

the documentation ( http://drc.ideablade.com/xwiki/bin/view/Documentation/include-related-entities - http://drc.ideablade.com/xwiki/bin/view/Documentation/include-related-entities)  says I should write
Customers.Include(Customer.PathFor(c => c.Orders.OrderDetail))

the problem is I can't access OrderDetail from the RelatedEntityList Orders, the property OrderDetail isn't available.

Note : I am using Code First, since PathFor isn't available in the Codefirst's entities I added your implementation in my base class




Replies:
Posted By: DenisK
Date Posted: 22-May-2012 at 6:06pm
Hi Walid,

As stated on on the wiki ( http://drc.ideablade.com/xwiki/bin/view/Documentation/include-related-entities#HStrongly-typedIncludes - http://drc.ideablade.com/xwiki/bin/view/Documentation/include-related-entities#HStrongly-typedIncludes ),

the use of strongly typed includes either with a PathFor or a Lambda expression is only applicable for simple property paths. The path that you're proposing is not considered "simple" since, just like you said, you can't access a scalar navigation property from a RelatedEntityList navigation property.


Posted By: Walid
Date Posted: 23-May-2012 at 12:38am
I missed this part on the wiki.

thanks



Print Page | Close Window