WebApi icon indicating copy to clipboard operation
WebApi copied to clipboard

EF Core & OData & TPH

Open marshal1501 opened this issue 4 years ago • 2 comments

Hi,

We have a dotnet core 3 project running with EF core 3.1.10 and we are running into an issue. We have multiple courtcasestatuses called "absent", "delayed" and so on. They all have their own class inheriting from courtcasestatus.

In EF core 3 the only option to map this to a database is TPH (https://docs.microsoft.com/en-us/ef/core/modeling/inheritance). Now this is working BUT for 1 type we have a reference to another table. Meaning in this example that the type "delayed" can have calendaritems. This is all working fine but we are unable to retrieve those calendaritems through OData. If we put the calendaritems on the basetype than it works but this is not matching our model as type "absent" should not have calender items.

How can we retrieve those calendar items belonging to the statuscasetype "delayed" with odata 7.5.2?

Thank you,

Jordi

marshal1501 avatar Dec 23 '20 12:12 marshal1501

Can you please share the model. Meanwhile you can try using the expand like $expand=namespace.delayed/calendaritems

Sreejithpin avatar Jan 06 '21 09:01 Sreejithpin

@marshal1501 Was this issue resolved?

KenitoInc avatar May 18 '22 11:05 KenitoInc

Closing this issue due to inactivity. If this issue still persists, feel free to create a new issue.

KenitoInc avatar Feb 10 '23 09:02 KenitoInc