AutoExpand attribute
Applies To:# OData WebApi v7 for aspnet webapi supported OData AspNet WebApi V7# OData Webapi for Webapi supported OData AspNet WebApi V6
In OData WebApi 5.7, we can put AutoExpand
attribute on navigation property to make it automatically expand without expand
query option, or can put this attribute on class to make all Navigation Property on this class automatically expand.
Model
public class Product
{
public int Id { get; set; }
[AutoExpand]
public Category Category { get; set; }
}
public class Category
{
public int Id { get; set; }
[AutoExpand]
public Customer Customer{ get; set; }
}
Result
If you call return Product in response, Category will automatically expand and Customer will expand too. It works the same if you put [AutoExpand]
on Class if you have more navigation properties to expand.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for