$expand with multiple tables

Assume we have these objects in the database

Order
OrderItem
Product
ProductType

An Order has multiple OrderItems. An OrderItem has a Product and each Product has a ProductType.

When using e.g. two grids to display Orders and OrderItems, I can modify the query getOrderItems() to use the $expand variable to include "Product" so that I can e.g. access a field form product using OrderItem.Product.Name

Now, how can I also include "ProductType" in this example, so that I can access fields like OrderItem.Product.ProductType.IsAvailable ? When only expanding "Product" in the query, I cannot access the ProductType field. Adding "ProductType" to the expand list does not work since OrderItem does not have a navigation for ProductType.

Any ideas how multiple levels can be expanded in a secenario like this?

Thanks for your help!

You can add Product.ProductType to getOrderItems()

You mean I should set $expand to: Product, Product.ProductType in this case?

I had a look at the database service class that you generate. The $expand is converted to something like:

items = items.Include(i => i.Product);

EF Core has another new method to include sub-types like this:

items = items.Include(i => i.Product).ThenInclude(x => x.ProductType);

Would that be an option and how can this be used by Radzen (I do not want to mess the generated database classes!)?

Thanks!