OData / OData/AspNetCoreOData

Odata 8 dynamic property received error: The given model does not contain the type 'System.Text.Json.JsonElement'

Open
#309 18 comments 0 reactions 0 assignees View on GitHub

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:
entity

My EDM:
edmModel

ServiceCollection:
services

Configure:
configuration

Controller:
code

Data created success:
dataSuccess

Error when query Get:
error

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.