I'm trying this with LlblGen v4.2 beta but don't think it is specific to that version.
I have an entity File and a related entity FileActivity (1->n).
I am trying to use queryspec to retrieve a set of File entities and the related FileActivity entities.
I would like to project the File entities into a List<FileModel> where FileModel is a poco and FileModel has a property which is a List<FileActivityModel> which would hold the related projected FileActivity entities.
I think I see something close to this in the documentation here
var qf = new QueryFactory();
var q = qf.Customer
.Where(CustomerFields.Country == "Germany")
.Select(() => new
{
CustomerId = CustomerFields.CustomerId.ToValue<string>(),
Orders = qf.Order
.CorrelatedOver(OrderEntity.Relations.CustomerEntityUsingCustomerId)
.Select(() => new
{
OrderId = OrderFields.OrderId.ToValue<int>(),
OrderDate = OrderFields.OrderDate.ToValue<DateTime?>()
})
.ToResultset()
});
But I don't see how to make the Orders collection in the help a List<OrderModels>
Can it be done? If so a sample would help.
Then a related question would be how to do the same projection when the relateed entities are retrieved using .WithPath and .WithSubPath?