Inheritance

Posts   
 
    
vs1784
User
Posts: 2
Joined: 29-Apr-2009
# Posted on: 06-May-2009 09:46:51   

I have a problem and not sure how to resolve it.

I have created a supertype entity e.g. Employee

ASP.NET page databinds EmployeeCollection to a treeview.

Employee has subtypes e.g. Manager, BoardMember.

When user clicks on treeview link i need to load entity from database.

How do i identify which subtype is it? and how do i load subtype instead of supertype.

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 06-May-2009 10:05:42   

How do i identify which subtype is it? and how do i load subtype instead of supertype

Just check on each entity's type. Eah fetched entity will be fetched in its won derived type.

And if laer you want to filter the fetched on collection basedon a type, you can use somethng like (entity type filtering):

filter.Add(BoardMemberEntity.GetEntityTypeFilter());
vs1784
User
Posts: 2
Joined: 29-Apr-2009
# Posted on: 06-May-2009 10:19:40   

You mean when i write

Employee e = new Employee(ID)

Will load Manager entity?

I am not sure what you tried to explain.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 06-May-2009 15:23:33   

I was speaking about fetching collections.

Please check Polymorphic fetches