Odata 8 dynamic property received error: The given model does not contain the type 'System.Text.Json.JsonElement'
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I'm using OData for my project. And my entity must have a dynamic property.
When I create an entity, its success as expected
But when I try to get entities I received error: The given model does not contain the type 'System.Text.Json.JsonElement'
My entity code:

My EDM:

ServiceCollection:

Configure:

Controller:

Data created success:

Error when query Get:

I using:
AspNet 5
Microsoft.AspNetCore.OData - v8.0.2
Npgsql.EntityFrameworkCore.PostgreSQL - v5.0.10
I tried add Microsoft.AspNetCore.Mvc.NewtonsoftJson - v5.0.10 and added AddNewtonsoftJson() after AddOData but not working
How can I do to fix this issue? Thanks for your support
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the GET failure using the entity, EDM, service configuration, and controller shown in the issue screenshots with Microsoft.AspNetCore.OData 8.0.2 and ASP.NET 5. Trace how the dynamic property is represented during query serialization; done means GET requests return the entity without the JsonElement model error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, postgresql
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100