With JayStack OData v4 Server you can build your own data endpoints without the hassle of implementing any protocol-level code. This framework binds OData v4 requests to your annotated controller functions, and compiles OData v4 compatible response. Clients can access services through OData-compliant HTTP requests. We recommend the JayData library for consuming OData v4 APIs.
Especially if you have a large model it doesn’t make sense to go through every property when the person doing the query is only getting a small a few of those properties in their query.
This speeds things up dramatically.
The implementation is simple. I take the incoming set of data (from the db query) and take the number of fields there against our total number of fields. If it's less then we know the request must have had a select to reduce the result set (or they model fields that don't actually exist).
Then to ensure we are not returning fields that aren't actually in the model and do an intersection of the two arrays.
Especially if you have a large model it doesn’t make sense to go through every property when the person doing the query is only getting a small a few of those properties in their query.
This speeds things up dramatically.
The implementation is simple. I take the incoming set of data (from the db query) and take the number of fields there against our total number of fields. If it's less then we know the request must have had a select to reduce the result set (or they model fields that don't actually exist).
Then to ensure we are not returning fields that aren't actually in the model and do an intersection of the two arrays.