Skip to content

Minimal APIs Cannot Expand Single Entity #1549

@andrew-turrentine

Description

@andrew-turrentine

With minimal APIs, I cannot figure out how to have $expand work properly when the $expand is one a single entity and not a collection.

If I use .FirstOrDefault(...) then I get expected results and a valid entity - $select even works.

However, if I try to use SingleResult<T> with .Where(...) for $expand then I start to get errors related to conversions or the wrapped type not being present in the model

The given model does not contain the type 'Microsoft.AspNetCore.OData.Results.SingleResult1[[Turpy.Nexus.Data.Entities.Organization, Turpy.Nexus.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'. (Parameter 'elementClrType')

Can someone give me an example of how to accomplish this or check if this is a bug? I can have it return a collection of 1 item but that is not very clean or performant.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions