Load a whole table using Adapter

Posts   
 
    
niti
User
Posts: 7
Joined: 28-Jun-2005
# Posted on: 30-Jun-2005 18:35:28   

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?

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 30-Jun-2005 19:08:44   

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);

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 30-Jun-2005 20:15:39   

Thanks Jeff. simple_smile

Niti: please consult also the Best practises -> How Do I ? section, as there this question is described as well simple_smile

Frans Bouma | Lead developer LLBLGen Pro
niti
User
Posts: 7
Joined: 28-Jun-2005
# Posted on: 30-Jun-2005 20:15:49   

Thank you for both promptness and exactitude.

niti
User
Posts: 7
Joined: 28-Jun-2005
# Posted on: 30-Jun-2005 20:17:16   

... and no other than the FIRST item. flushed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 30-Jun-2005 20:30:05   

stuck_out_tongue_winking_eye

Frans Bouma | Lead developer LLBLGen Pro