Tab pages best practices?

Posts   
 
    
silat
User
Posts: 57
Joined: 24-Mar-2006
# Posted on: 18-Jul-2006 09:53:46   

Hello All,

Ok, I have read a bunch of post and understand that lazy loading and adapter do not fit well in the current design.

However, I would like some insider views for a very common problem (IMHO) and the way, you guys resolved it using adapter:

I am having a DAL, and a BL (Manager classes).

Then on the PL side, I have a complex form with customer’s information.

On this form I have a lot of tab pages for, for example, customer’s orders, customer’s subscription, customer’s interests. Each of the tab contains a collection (0-n relations): - Customer.Orders - Customer.Subscriptions - Customer.Interests

How would you handle that? I only want to load the data when the user clicks on a tab and not load everything into memory at the displaying of the form. Code snipplet for BL, DAL and PL appreciated smile

Cheers,

Silat

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 18-Jul-2006 15:19:31   

There must be an event raised when switching between tabs, and then you should use the example shown in the docs "Using the generated code -> Adapter -> Using the entity collection classes -> using a related entity" to fetch the related entities.

Example:

// C#, .NET 1.x
CustomerEntity customer = new CustomerEntity("CHOPS");
DataAccessAdapter adapter = new DataAccessAdapter();
EntityCollection orders = customer.Orders;
adapter.FetchEntityCollection(orders, customer.GetRelationInfoOrders());