3

The ODATA $expand=* term expands all properties of an entity. But in the TPH pattern, it expands only the base class reference properties:

public abstract class Person
{
     [Key]
     public int Id {get; set; }

     public Place BirthPlace { get; set;}
}

public class Customer : Person
{
  public Job Job{get;set;}
}

public class Employee : Person
{
  public Post Post{get;set;}
}

Executing ODATA query: /odata/Persons?$expand=* only expands the Place.BirthPlace reference property; not the Customer.Job nor Employee.Post

But expanding a single entity works well as expected: /odata/Persons(411)?$expand=* expands Place.BirthPlace and either Customer.Job or Employee.Post based on the type of the entity

How to expand all referenced entities in the TPH scenario?

Khodaie
  • 346
  • 4
  • 17

0 Answers0