Hi,
I use this inheritance hierarchy:
ShotEntity based on CoreEntity
TaskEntity based on CoreEntity
ShotEntity can have TaskEntity as a child.
There are a lot more classes and the relationships need to be dynamic that's why ShotEntity doesn't have a Tasks property but rather CoreEntity has a porperty called CoreChildren which is a collection of CoreEntity objects.
Now to be able to bind this collection I would like to use the following so that the Grid can databind the sub type properties correctly:
[TypeContainedAttribute(typeof(MyTaskEntity))]
public override EntityView2<CoreEntity> ChildrenAsTasks
{
get
{
EntityCollection<CoreEntity> toReturn = base.CoreChildren;
toReturn.EntityFactoryToUse = new MyTaskEntityFactory();
return toReturn.CreateView(CoreFields.EntityTypeId == 2) as EntityView2<CoreEntity>;
}
}
[TypeContainedAttribute(typeof(MyShotEntity))]
public override EntityView2<CoreEntity> ChildrenAsShots
{
get
{
EntityCollection<CoreEntity> toReturn = base.CoreChildren;
toReturn.EntityFactoryToUse = new MyShotEntityFactory();
return toReturn.CreateView(CoreFields.EntityTypeId == 3) as EntityView2<CoreEntity>;
}
}
So my question is if you see any problems with this approach?
Thanks,
Patrick