when we issue this query:
customers.Select(c => c.Orders)
currently we generate a new instance of Orders collection type. Instead we could/should grab the collection instance from the parent entity and use it instead. This way we can better handle all exotic cases, where customer collection is exposed as interface, doesnt have parameterless ctor etc.
In fact, we could potentially leverage include pipeline for this case. Include gets parent entity and collection of its children, associates them together and returns the parent entity. For this case the only difference is that we have to return collection instead.
when we issue this query:
currently we generate a new instance of Orders collection type. Instead we could/should grab the collection instance from the parent entity and use it instead. This way we can better handle all exotic cases, where customer collection is exposed as interface, doesnt have parameterless ctor etc.
In fact, we could potentially leverage include pipeline for this case. Include gets parent entity and collection of its children, associates them together and returns the parent entity. For this case the only difference is that we have to return collection instead.