I'm working with entities in WebApi application that have a linked entities.
For example:
- Entity Street has the following related resource:
City
- Entity
City
has:Region
,CityType
- Entity
Person
:Address
,Nationality
,Position
,Catalog
,Documents
...
How can I proper route related entities?
Before I used OData request like: http://localhost:3761/api/City?$expand=CityType,Region
for City
and http://localhost:3761/api/Person?$expand=Address,Nationality,Documents,Catalog
for Person
.
But most client do not know which exist related objects. And they want to add some parameter to request that will get entity with all linked data.
Example http://localhost:3761/api/Person/full
or http://localhost:3761/api/Person/2/full
for Person with ID
= 2.
I tried to implement it but I have problem with routing. So as I have a base api controller then attributes is not inherited to my child controller and as a result it doesn't work.
Could you please suggest me what is the best practice to route related entities?
P.S: Sorry for my English and let me know if something is not clear.
Thanks