simple-odata-client / Simple.OData.Client

MIT License
330 stars 196 forks source link

Expanding Multiple Children #44

Closed mcurrycl closed 10 years ago

mcurrycl commented 10 years ago

Thanks for this useful library.

I have a Customer entity hosted in an MVC/WebAPI2 project.

Customer has a collection of PhoneNumbers and a collection of Orders, I want to expand both collections when loading a Customer.

The code:

Client.For().Expand("Orders,PhoneNumbers").Key(CustomerId).FindEntryAsync()

causes an exception:

UnresolvableObjectException: Association Customer.Orders,PhoneNumbers not found

Is expanding multiple children supported?

object commented 10 years ago

Thank you for the issue report. I will investigate what can go wrong. I will either post a fix in the current version (3.x) or in case it is more complicated there is a new major release on its way that will add support for JSON payload and OData 4, it will handle multiple expansions as well.

object commented 10 years ago

Hi again,

I've checked the source code. It supports multiple expansion when it's specified as a collection. Can you try the following: For().Expand(new [] {"Orders","PhoneNumber"}).Key()...

Let me know how it goes.

mcurrycl commented 10 years ago

Works perfectly, thank you for your help!

Looking forward to the next release, cheers.

object commented 10 years ago

For you information: I have uploaded a 4.0.0-rc1 of Simple.OData.Client that supports OData V4 protocol and JSON payload. You can give it a try.