Hi Walaa,
Thanks for that info, so it is possible to do. I reviewed the derived classes in my solution, but they dont seem to offer the relationships correctly:
/// <summary>
/// Gets the EntityCollection with the related entities of type 'MyStorageItemEntity' which are related to this entity via a relation of type '1:n'.
/// If the EntityCollection hasn't been fetched yet, the collection returned will be empty.
/// </summary>
[TypeContainedAttribute(typeof(MyStorageItemEntity))]
public override EntityCollection<StorageItemEntity> ChildStorageItems
{
get
{
EntityCollection<StorageItemEntity> toReturn = base.ChildStorageItems;
toReturn.EntityFactoryToUse = new MyStorageItemEntityFactory();
return toReturn;
}
}
Sholdn't that be returning a collection of EntityCollection<MyStorageItemEntity> as opposed to EntityCollection<StorageItemEntity>?
/// <summary>
/// Gets / sets related entity of type 'MyStorageItemEntity' which has to be set using a fetch action earlier. If no related entity
/// is set for this property, null is returned.
/// This property is not visible in databinded grids.
/// </summary>
[Browsable(false)]
public new virtual MyStorageItemEntity ParentStorageItem
{
get { return (MyStorageItemEntity)base.ParentStorageItem; }
set { base.ParentStorageItem = value; }
}
When I try to access this property I just recieve a invalid cast exception.
How do I access the properties to return the correct type and avoid the cast exception?
Thanks!
Alex