I am trying to design business entities in .NET like below which will be exposed via Web API/oData.
Business Entity 1 : "Vehicle" with the properties as below:
- VehicleId string
- ModelId string
Business Entity 2 : "Model" with the properties as below:
- ModelId string
- ModelDescription string
Now if someone uses my Web API to fetch Vehicle information only and wants to display Model description also then they need to make 2 HTTP calls which will result in degradation of performance specifically in slow networks. In this scenario I would like to know what is the best way to load & model nested business entities which will provide optimum performance via Web API?
Shall I model my Vehicle class as below and is it really a good practise for a REST/Web API design? For the below approach the entity seems to become too heavy also due to contained entities also. Please advise.
Business Entity 1 : "Vehicle" with the properties as below:
- VehicleId string
- ModelId Model