Good day.
Need your help. There is an ASP.NET WebApi application in which you need to submit a link between two resources. For example, there is a StreetType entity that returns json:
{ "id":3, "name":"StreetType1", } and the essence of Street :
{ "id":1, "name":"Street1", "streettypeid":3 } Previously, to obtain related resources, I used the OData request: http://localhost:3761/api/Street?$expand=StreetType
But, since in some entities there may be 3 or more related resources, then it will be difficult to write such requests, and not very beautiful.
It would be nice to implement this as follows:
http://localhost:3761/api/Street/- allStreethttp://localhost:3761/api/full/Street/- allStreetand related resources (in this case only StreetType)http://localhost:3761/api/Street/1-StreetwithID = 1http://localhost:3761/api/full/Street/1-StreetwithID = 1and related resources
But there is a problem with the routing system and attribute inheritance. Since all this should be implemented in the base class.
Question: How to correctly implement the representation of related objects? How to issue a simple URL for example for such an OData request: http://localhost:3761/api/City?$expand=CityType,Region