You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by "Prathamesh Joshi." <pr...@vrhythmstech.com> on 2016/02/02 07:04:56 UTC

How to implement NavigationProperties.



Hi All, 

 I went through a documentation of odata 2.0 from odata site it shows
that  NavigationProperties are like relationships
between to entities which is correct. 

As shown in this  http://services.odata.org/OData/OData.svc/$metadata
document  Product entity is associated with
Category entity.  And further  more 

if I hit this http://services.odata.org/OData/OData.svc/Categories(1)/Products URI
then list of Products associated with Category 1
will be retrieved .

However I can't understand how to implement mapping of these entities.
Currently I am facing following questions. 
1) In Single
Processor's do I need to manually extract  Products associated with
Category 1 and return it back ?

2) If so then what is the use of listing NavigationProperties  in
$metadata document. 

3) And what is a difference between having ComplexType and above approach
?

 
--

Thank you.

Prathamesh Joshi.

+91 9960 414 777

Re: How to implement NavigationProperties.

Posted by Ramesh Reddy <ra...@redhat.com>.
> 1) In Single Processor's do I need to manually extract Products associated
> with Category 1 and return it back ?
Yes, however how you retrieve is decided by your implementation. If you are working with databases think of them as relationships, what you returning interms of links are foreign keys to get to them, not the whole record. 

> 2) If so then what is the use of listing NavigationProperties in $metadata
> document.
What is $metadata is metadata of the service, what you return when you query is the data about the entity and its properties 

> 3) And what is a difference between having ComplexType and above approach ?
ComplexType are properties of entities, they are included in the payload of the entity and are not directly referenceble. Where as navigation properties are other entities that related to the entity you are querying and have their own identity and directly accessible. 

HTH 

Ramesh..