How to override a collection type for binding to a DataGrid

Posts   
 
    
ferhaad
User
Posts: 5
Joined: 05-Nov-2007
# Posted on: 25-Jan-2008 16:37:32   

Need your assistance on this issue.

We need to fetch certain entities, e.g. PlayContainerEntities. We also need the underlying PlayerStreamCollection within each PlayContainerEntity as well.

We have extended these classes as we need to add in extra information for showing in Datagrid

The hierarchy goes like this

  • DbPlayContainerEx extension of PlayContainerEntity

Each PlayContainerEntity contains PlayerStreamCollection and we want it to be our defined type rather than of type PlayerStreamEntity so we defined the below class as well

  • DbPlayerStreamEx extension of PlayerStreamEntity

All PlayContainerEntity are easily loaded into our defined EntityCollection<DbPlayContainerEx> m_playContainerCollectionNew.

Using these statements we fetch the required data:

IPrefetchPathElement2 prefetchPath = DbPlayContainerEx.PrefetchPathPlayerStreamCollection; prefetchPath.EntityFactoryToUse = new DbPlayerStreamExFactory(); fetchPath.Add(DbPlayContainerEx.PrefetchPathPlayerStreamCollection, new DbPlayerStreamExFactory()); adapter.FetchEntityCollection(m_playContainerCollectionNew, null, int.MaxValue, Order, fetchPath);

playContainerCollectionNew contains the collection of all PlayContainer Entities and the corresponding PlayerStreamCollection for each PlayContainer Entity. PlayerStreamCollection is shown as a collection of our defined type DbPlayerStreamEx. But when we bind this collection to our DataGrid it doesn’t get displayed in the DataGrid.

Setting AutoGenerateFields=”True” in our DataGrid settings we see that PlayerStreamCollection is in fact of type PlayerStreamEntity and all the fields of PlayerStreamEntity are displayed as columns rather thanour custom defined properties in DbPlayerStreamEx. How could I override PlayerStreamCollection in my custom defined DbPlayContainerEx

Any suggestion is appreciated.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Jan-2008 01:18:44   

Could you please:

  • attach the class for your extended entity.
  • post the code snippet where you are binding the data.
  • if your are using LLBLGenProDataSource, post the relevant part of the declarative ASPX.
David Elizondo | LLBLGen Support Team
ferhaad
User
Posts: 5
Joined: 05-Nov-2007
# Posted on: 26-Jan-2008 22:06:13   

Thanks for reply,

I have explained the hierarchy and to clear things up I'll summarize it again here.

I have a collection of PlayContainerEntities. Each playcontainer entity has a collection of PlayerStream Entities exposed through PlayerStreamCollection property. And each PlayerStream Entity has a collection of Player Entites exposed through PlayerCollection property.

I have extended all these classes and added some extra properties to of my extended classes. PlayerStreamCollection and PlayerCollection properties that I am having trouble in overriding. The individual object within these collection appear to be of my defined type but the collection as whole appears to be of BASE CLASS TYPE.

Either I am missing something in the Corresponding derived factory classes for exposing additional properties or need a way to override the base class collection properties in my derived classes.

anyhow attached code may help you to better understand the problem and suggest me a solution.

Thanks Nasir

Attachments
Filename File size Added on Approval
LLBLGEN Query.rtf 38,223 26-Jan-2008 22:15.26 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Jan-2008 03:19:49   

Hi Nasir,

We are trying to reprodue this. Please let me know if the problem persist if you don't pass the prefetchpath. Also, a more tiny code or example would be useful here to indentify the issue quickly.

David Elizondo | LLBLGen Support Team