New Posts New Posts RSS Feed: Using PathFor with Collections
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Using PathFor with Collections

 Post Reply Post Reply
Author
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Topic: Using PathFor with Collections
    Posted: 23-May-2012 at 12:38am
I missed this part on the wiki.

thanks
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 22-May-2012 at 6:06pm
Hi Walid,


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.
Back to Top
Walid View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Nov-2010
Posts: 161
Post Options Post Options   Quote Walid Quote  Post ReplyReply Direct Link To This Post Posted: 22-May-2012 at 1:45pm
Hi,

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

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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down