What are the performance and other implications of the different methods of retrieving entities?
I've looked around the forums for this answer, perhaps if it's been addressed someone can send me a link. I'm just wondering what method of selecting entities is best performance wise (and any other reasons anyone can think of). Some benchmarks or just numbers for comparison would be nice.
Are any of the approaches more suited to large or small datasets?
I've included three examples for selecting the orders that have shipped before now from a customer:
ShipDateCustomerEntity Customer = new CustomerEntity(id);
OrderCollection orders = customer.Orders;
Looping:
foreach (OrderEntity order in Customer.Order)
{
if (order.ShipDate < DateTime.Now)
{
orders.Add(order);
}
}
LLBLGen Filters:
CustomerEntity customer = new CustomerEntity(id);
OrderCollection orders = customer.Orders;
IPredicateExpression main_filter = new PredicateExpression();
main_filter.Add((OrderFields.ShipDate <= DateTime.Now));
orders.GetMulti(main_filter);
LINQ:
I know this is upcoming in 2.6, but perhaps the devs can comment on this.
OrderCollection orders = customer.Orders;
var query =
from o in Orders
where c.ShipDate <= DateTime.Now
select c;
Thanks for an excellent product and brilliant support!