You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my old code, I was able to construct the OData EDM Models on a per request basis (depending on the user's claims). So the structure of the EDMs would vary based on the user's claims. I do this to hide certain entitySets that certain users shouldn't have access to OR not expose certain properties on a specific entitys. I'm wondering if there's a way to do it similarly in the newer library?
For now, I'm using pretty much the pattern shown in the provided examples and am planning to workaround not being able to dynamically generate EDM's based on the User's claims.
Thank you!
The text was updated successfully, but these errors were encountered:
OData 8+ fundamentally changed how things work under the hood. The EDM and routes are built ahead of time. The only way I know of that you can get in front of the EDM is via IOptions<ODataOptions>. This is what API Versioning itself does. It's very yucky and comes with all kinds of sharp edges. You can have a look at:
For this type of scenario, I think you'd be better off adding annotations to your model and changing the ODataInputFormatter and ODataOutputFormatter to control/limit what goes over the wire. There might even other alternatives, but that's what immediately comes to mind. If you do come up with some way to copy or generate a new EDM, don't for forget to add or copy the ApiVersionAnnotation. I expect API Versioning with OData will break without that.
Hello,
Thank you for the support and maintaining this library. I'm in the process of updating my code from
.NET6 and OData v7
to .NET8 and OData v8 and updated versioning:
In my old code, I was able to construct the OData EDM Models on a per request basis (depending on the user's claims). So the structure of the EDMs would vary based on the user's claims. I do this to hide certain entitySets that certain users shouldn't have access to OR not expose certain properties on a specific entitys. I'm wondering if there's a way to do it similarly in the newer library?
How I did it in my old code:
For now, I'm using pretty much the pattern shown in the provided examples and am planning to workaround not being able to dynamically generate EDM's based on the User's claims.
Thank you!
The text was updated successfully, but these errors were encountered: