I have a company entity with a one to many relationship to order entities.
An order can be anonymous, in which case the related company should not be loaded when querying the orders.
The current format creates an IQueryable and then adds filters to it as follows:
IQueryable<Order> queryable = ...
...
if (includeCompany is not null and true)
{
queryable = queryable.Include(o => o.Company);
}
if (includeAddress is not null and true)
...
Can I condition the include to use the order's isAnonymous bool in a single query, as to only include the company entity for the orders that are not anonymous?