accessing collections

Posts   
 
    
exp2000
User
Posts: 68
Joined: 13-Apr-2006
# Posted on: 28-Jun-2006 15:57:18   

Just a quick question, If I have an object that exposses a collection (EntityCollection) of related objects is it ok to access fileds via index, rather then casting each object in collection to a entity type to access the field.

entity.Group(idx).Fields(GroupFieldIndex.DimensionId).CurrentValue

vs.

DirectCast(entity.Group(idx),GroupEntity).DimensionId

Or, is there a way to have strongly typed collection (GroupCollection vs. EntityCollection)?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 28-Jun-2006 16:15:33   

If you are using the SelfServicing scenario, then you will get strongly typed collections out of the box. But in Adapter scenario, you should cast EntityCollection items to their corresponding Entity Type.

However in .NET 2 using generics, you can have stronglyTypes collections

Please refer to the following threads: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=5287 http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=4294 http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1782

.NET2: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=5829