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
Pretty new to Alba, however I have been using it successfully against OData endpoints with the AspVersioning library. I think there is a bit of a nuance, I'm using Asp.Versioning.OData@7.0.1. Although the OData requests go through controllers, the serialization aligns with the MinimalApiStrategy. In the AlbaHost constructors, the input/output formatters are of type ODataInputFormatter and ODataOutputFormatter, so the MvcStrategy is initialized.
var jsonInput = findInputFormatter("application/json");
var jsonOutput = findOutputFormatter("application/json");
if (jsonInput != null && jsonOutput != null)
{
MvcStrategy = new FormatterSerializer(this, jsonInput, jsonOutput);
}
MinimalApiStrategy = new SystemTextJsonSerializer(this);
DefaultJson = MvcStrategy ?? MinimalApiStrategy;
So the DefaultJson is then set to the MvcStrategy and I guess OData isn't a fan.
I have not really tested this against the library, I just grabbed the source and hacked in a couple overloaded constructors and For<>... methods and so far things have been working. Not sure if this helps anyone, or not, but I too had the pleasure of banging my head against the wall with the Asp.Versioning and OData libraries so thought I'd post just in case!
@ticky74 Would you mind sharing your Hack?
Struggeling with a similar Problem, using OData@7.18.0 as a transitive dependency of the ResTier Framework@1.1.0. When Posting Alba supports handing over the MinimalApiStrategy, so we can successfully post json - but when trying to use the ReadAsJson Methods, we get Deserialization Exceptions. Currently stuck testing with ReadAsText which is crude in comparison
More research necessary
The text was updated successfully, but these errors were encountered: