Inheritance and collections

Posts   
 
    
Sam avatar
Sam
User
Posts: 95
Joined: 30-Jun-2004
# Posted on: 01-Nov-2005 19:55:36   

I love the new inheritance feature but want to be able to do something like this: Say I have a base class Entity Base and in the designer I create a class SubClass the inherits from base. And say I have another Collection SomeClass that contains a collection of Base. What I want to do is:

SomeClass someClass = new SomeClass("foo") someClass.SubClass

but all I can do is someClass.Base

Can I do this without creating a predicate to filter? I tried adding the SomeClass subclass relation in the editor but the code will not compile if I do so (creates duplicate methods).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 02-Nov-2005 17:25:47   

Creating a relation between supertype and subtype is not appropriate unless it actually is a relation (employee - manager for example)

You can create the relation, it can be you created duplicate field names for the fields mapped onto relations. These aren't overriding eachother.

Frans Bouma | Lead developer LLBLGen Pro
Sam avatar
Sam
User
Posts: 95
Joined: 30-Jun-2004
# Posted on: 04-Nov-2005 17:29:54   

Okay, let me give a more concrete example and you can tell me if I am using this feature correctly. I have a SalesEntityBase in my database. SalesEntityBase consists of a number of different "SalesEntites". There is an ObjectType Field in the SalesEntityBase table. What I have done is create a Prospect entity and Suspect entity using the appropriate discriminator value in the ObjectType field. Is this a legit use of the inheritance feature? SalesEntityBase is related to user. I was hoping that I could do something like User.Suspect and get SalesEntityBase's that were of ObjectType Suspect. Can this be done or am I just confused on the use of this feature?