AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

Auto expand doesn't work for the nested expanded entities using $expand

Open khodaie opened this issue 3 years ago • 1 comments
trafficstars

When applying the AutomaticallyExpand or [AutoExpand] for a navigation property, the expected behavior is to expand it automatically. It works when getting the entity from root level, but it doesn't work if the entity is expanded by a $expand clause. The previous ODATA version I used was 5.11.0 and it worked normally. But after upgrading to the version 8, it doesn't work anymore.

public class Book 
{
 public int Id {get; set; }
 public Author Author{get;set;}
}

public class Author
{
  public int Id{get;set;}
 [AutoExpand]
 public IList<Address> Addresses{get;set;}
}

public class Address
{
 public int Id{get;set;}
 public string Address{get;set;}
}

...

GET /odata/Authors

Successfully expands the Addresses of the Authors.

GET /odata/Books?$expand=Author 

Doesn't expand the Addresses of the Book/Author.

khodaie avatar Sep 28 '22 07:09 khodaie

This is still present at this time. Is there any way to fix this?

thoma01 avatar Oct 04 '23 02:10 thoma01