niti wrote:
Hi,
how do you do the equivalent of SELECT * FROM Orders using the Adpater pattern?
I ask this because in the documentation (Generated code - Using the entity collection classess, Adapter), you give the following example:
CustomerEntity customer = new CustomerEntity("CHOPS");
DataAccessAdapter adapter = new DataAccessAdapter();
EntityCollection orders = customer.Orders;
adapter.FetchEntityCollection(orders, customer.GetRelationInfoOrders());
Say I do not want just the orders for 'CHOPS', I want all the orders .
Maybe it's obvious in the documentation, but I don't get it and I appologize for that.
How do I get them?
The "customer.GetRelationInfoOrders()" is the filter that limits what gets fetched into the "orders" collection. So, pass null as the filter and all entities will get returned.
Also, if you you're just looking for a generic entity container, there's no need to use the Orders collection on the customer entity. Just:
EntityCollection orders = new EntityCollection(new OrderEntityFactory());
adapter.FetchEntityCollection(orders, null);