LLBLGen EntityCollection<T> does not inherit from List<T>

Posts   
 
    
Posts: 22
Joined: 11-Jan-2008
# Posted on: 27-Mar-2008 05:04:21   

I was surprised to know that LLBLGen EntityCollection<T> does not inherit from List<T>. I think this is one of the most important feature which we were all surpsied to know the product does not support.

What is the best way to code like this.

        DataAccessAdapter adapter = new DataAccessAdapter();
        EntityCollection<ShopEN> shopList = new EntityCollection<ShopEN>();
        adapter.FetchEntityCollection(shopList, null);

        ShopEN shop = new ShopEN(1004);
        adapter.FetchEntity(shop);

        lookupHyperLinkEdit1.DataSource = shopList;
        lookupHyperLinkEdit1.SelectedIndex = **shopList.FindIndex(delegate (ShopEN item) { return item.IdShop = shop.IdShop});

**

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 27-Mar-2008 09:59:20   
            DataAccessAdapter adapter = new DataAccessAdapter();
            EntityCollection<ShopEN> shopList = new EntityCollection<ShopEN>();
            adapter.FetchEntityCollection(shopList, null);

            IPredicate filter = (ShopFields.Id == 1004);
            List<int> indexes = shopList.FindMatches(filter);

            lookupHyperLinkEdit1.DataSource = shopList;
            lookupHyperLinkEdit1.SelectedIndex = indexes[0];
Posts: 22
Joined: 11-Jan-2008
# Posted on: 27-Mar-2008 10:27:42   

yes i did the same thing this morning but the bottom line of this is that llbgen EntityCollection took away the built it powerful Function Programming support of generics.

Is this something taken consideration in future versions or?...

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 27-Mar-2008 11:13:14   

If you trace the inheritance tree you will find the following:

EntityCollection<TEntity> : EntityCollectionBase<TEntity>
EntityCollectionBase<TEntity> : CollectionCore<TEntity>
CollectionCore<T> : IList<T>, IList
Posts: 22
Joined: 11-Jan-2008
# Posted on: 27-Mar-2008 11:36:33   

yup. i already did. it just implement IList and other generic interfaces. but that is fine, just that I am used to those function methods like Find, FindAll, FindIndex, ForEach etc. Llblgen FindMatches i think should return Entitycollection<TEntity> not List<int>. But anyway, its workable simple_smile

Many thanks.