Dynamically adding a field to an entity collection

Posts   
 
    
alexdresko
User
Posts: 336
Joined: 08-Jun-2004
# Posted on: 02-Jan-2007 23:43:47   

LLBLGen version: 2.0.0.0 final OS: XP SP2 Template set: Self servicing, C# Project language: VB.NET Favorite zoo animal: Gorilla

Let's take the following simple code block for example...


Dim animals As New AnimalCollection

animals.GetMulti(null)

someGrid.DataSource = animals

Is it possible to add a field on a related field here (before the DataSource line)? For example, let's say there is a GorillaAttributeCollection with a 1:1 relation on AnimalCollection.

My grid, which already exists, is already bound to the AnimalCollection. AnimalCollection has its own relationships and such which must remain intact for the form to work properly. However, in SOME cases, I need the grid to display additional fields from the GorillaAttribute collection.

Can this be done?

(No animals were harmed in the creation of this post)

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 03-Jan-2007 01:17:19   

I don't think you can add a dynamically created field on related field. What you could do is prefetch this other gorillaAttribute entity and then for instance with a grid use the RowDataBound event to fill in the information from the related GorillaAttribute.