Why no Typed Collections in Adapter?

Posts   
 
    
JeffD
User
Posts: 4
Joined: 07-Jan-2005
# Posted on: 08-Jan-2005 00:06:34   

I'm trying to decide whether to use Adapter or 2Class for a new project and have one hangup with the adapter model.

Why doesn't the adapter scenario provide typed collections? Having to cast everything when you pull it out of a collection each time seems painful. Is there a reason for this design decision that I just don't understand? Is that what everyone is doing?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 08-Jan-2005 11:58:01   

Typed collections are a limiter on inheriting classes from entity classes. Say you create a new Order class derived from OrderEntity with a new property: OrderTotal. The OrderCollection class still contains OrderEntity instances, not the order class you wrote. So you have to update all references to the order collection to a new collection. Which can be cumbersome. (I ran into this with selfservicing, that's why I decided to make a generic entitycollection class).

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 08-Jan-2005 19:29:48   

What are you guys referring to here by "typed collections"? You can still pass read-only typed lists around, right? Do you mean the entity collections?

I'm very interested in this because I'm going to use remoting on a new project, so I believe I will have to make the leap from self-servicing to Adaptor model.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 08-Jan-2005 21:09:06   

Yes, typed entity collections, like CustomerCollection, instead of EntityCollection with customers.

Frans Bouma | Lead developer LLBLGen Pro