Replies: 2 comments
-
I won't pretend I have even a good suggestion here, but this:
Seems like absolute hell to me... at this point it feels like you are fighting the framework so much that it might not be worthwhile trying to use it at all. Having said that, if I had such a crazy system, I would maybe look at how To be fair though, if I really was in your position, I would be pursuing some sort of simplification that avoided this in the first place. |
Beta Was this translation helpful? Give feedback.
-
On the other hand, I would suggest looking into implementing custom output formatters in your API to add support to your various formats instead of implementing it inline like that at the controller action level. I'm pretty sure that part should be completely independent of how the rest of OData works. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Sytem
Background
About two years ago, my team decided to implement OData in our existing API, despite having no prior experience with it. Due to the nature of our application and our customers' needs, we must ensure backwards compatibility with nearly all changes.
At the time, our API was split into two:
Initial OData Implementation
$filter
,$skip
) from requests and applying operations to SQL commands.$filter
.$select
and$expand
were not supported at all.For the EF Code-First endpoints, the implementation was smoother, but:
api/v1/endpointCategory/...
resource prefix without breaking parts of OData.The Current Issue
We recently refactored the old SQL-based endpoints to use EF (Database-First) and OData. However, we now face a new set of challenges:
_guid
,source
,...
defined, which tells us that both the forementioned classes has these columns as well. By recursing and concatenating all attributes on the base-class all the way up to the top level class, we know what attributes to expose on the endpoint. The reason it is like this is because we also use this structure for operations in Azure Data Factory.Question
Given that we're too committed now to back out and the above constraints, how can we best approach this implementation while ensuring:
I guess the root of my problems is that odata seems to me to be an all-or-nothing type of standard, I would love to just use the ODataQueryOptions for building select, expand, filter, top and skip without all the extra stuff that follows like the $metadata inspection (which I do like, but I would give this up in a hartbeat if I had to for this to work properly) and the $data debug endpoint.
The current state (attempt at a PoC) of the code for this service looks something like this:
Beta Was this translation helpful? Give feedback.
All reactions