Skip to content
Advertisement

Why Is My API Not Returning Nested Object (.NET 6 Entity Framework and SQL DB)

I have created an API, using EF and database first approach via scaffolding.

I have the following in my context file

and then the following in my models

Request:

Request Line:

My Request controller looks like this:

In Swagger, it is displayed correctly in the example, based on the model:

But when running the GET, what I am actually seeing is:

The requestLines lists are showing empty, but there is data present in my DB for these.

Apologies for the length of the question. If further information is needed please let me know.

Thanks in advance!

Advertisement

Answer

Something like this

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement