Closed bitsnorbytes closed 1 year ago
This looks like a dependency collision? These libraries make use of JSON.NET for serialization/deserialization. Is it possible that dependency isn't installed on your project? First time seeing this one!
@acupofjose Yes, that seems to be the issue. I added installed this package via dotnet add
dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson --version 7.0.5
followed by
builder.Services.AddControllers().AddNewtonsoftJson();
in my Program.cs where are all services are initialized and it worked!
By default, the dotnet picks up System.Text.Json for deserializing / serializing if NewtonsoftJson is not installed. Is this mentioned in the document anywhere ? Can we incorporate this if not already ?
Thanks
Interesting! Do you think the README would have been the best place for you to find that info? Thanks for the help!
Interesting! Do you think the README would have been the best place for you to find that info? Thanks for the help!
Yes definitely! Also, When building blazor wasm, one of the optimisation recommendations for AOT - Use System.Text.Json. Do you think this can be incorporated in future releases?
Agreed, it's an optimization that would be nice, but I there are several custom converters using JSON.NET at the moment that I would require some modifications to work with System.Text.Json
. It seems that performance-wise it would be an optimization that would have some benefit to the libraries!
For now, it'll have to be a future item!
Readme is updated - thanks for the issue @bitsnorbytes!
Bug report
Describe the bug
I am writing an API application which does CRUD operation on supabase database.
This is my Model class.
This is my controller class.
This is the service that handles the Database from the controller.
This is the where the service is passes via DI
When I run this the code and do a get , I get the following error.
The below snippet from the error seems to be the problem.
The type 'Postgrest.Attributes.PrimaryKeyAttribute' is not a supported dictionary key using converter of type 'System.Text.Json.Serialization.Converters.SmallObjectWithParameterizedConstructorConverter
When I looked for a fix, I got results of creating a custom converter for JSON Serialization.
To Reproduce
Configure the code components as described above.
Expected behavior
To fetch the rows from the database and return a JSON of the results.
Screenshots
If applicable, add screenshots to help explain your problem.
System information