EntityCollection And Inherited Classes

Posts   
 
    
LukeO
User
Posts: 58
Joined: 23-Jul-2007
# Posted on: 01-Aug-2007 01:39:44   

I've tried this two ways and so I'm wondering if there is a thread out there where this may have been explained already. I searched on "EntityCollection Inheritence" and didn't find what I was looking for so here goes.

My goal is something like this:

'Plan is inherited from PlanEntity and has a readonly property called PlanInvestments 'which is an entity collection(Of PlanInvestmentEntity). Dim aPlan As New Plan("planID")

'I also have a class called PlanInvestment which is inherited from PlanInvestmentEntity 'I've added some custom methods and so forth to this class (e.g. GetPrice). 'So far so good.

I cannot for the life of me figure out how I can do this: aPlan.PlanInvestments(0).GetPrice

Basically I want to somehow either structure the code or convert the EntityCollection from being EntityCollection(Of PlanInvesmentEntity) to EntityCollection(Of PlanInvestment).

I'm using adapter with two classes (I've tried both one class and two class) and currently modifying the "My<xxx>Entity" classes.

Thanks, -Luke

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 01-Aug-2007 10:40:45   

I think that's a parallel hierarchy, please check the following thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10323

LukeO
User
Posts: 58
Joined: 23-Jul-2007
# Posted on: 01-Aug-2007 19:19:07   

Your right. This is exactly it. However one question user chrishilton posts is this:

"I have generated my project with the selected SD.Presets.Adaptor.TwoClasses2005 which creates me an EntitySubClasses directory containing the derived classes eg. MyViewGroupEntity. However the ViewEntryEntityCollection of MyViewGroupEntity still contains ViewEntryEntity objects so have I missed something out?"

There was no reply to this question which is basically the same question I'm asking since it is at the same spot I'm at.

Thanks, -Luke

Walaa wrote:

I think that's a parallel hierarchy, please check the following thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10323

LukeO
User
Posts: 58
Joined: 23-Jul-2007
# Posted on: 01-Aug-2007 22:50:29   

I think I got this figured out. My approach seems to have been wrong. I was placing code which I originally had in the partial base class into the new inheritied class which should've stayed in the partial base class.

That way I don't need to deal with things NOT showing up in the derived classes and just use the inherited classes with custom changes made to the template.

LLBLGen is really cool but it does required some... work to really get into.

Thanks for the help.

-Luke

LukeO wrote:

Your right. This is exactly it. However one question user chrishilton posts is this:

"I have generated my project with the selected SD.Presets.Adaptor.TwoClasses2005 which creates me an EntitySubClasses directory containing the derived classes eg. MyViewGroupEntity. However the ViewEntryEntityCollection of MyViewGroupEntity still contains ViewEntryEntity objects so have I missed something out?"

There was no reply to this question which is basically the same question I'm asking since it is at the same spot I'm at.

Thanks, -Luke

Walaa wrote:

I think that's a parallel hierarchy, please check the following thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=10323