Extended Templates Class Property Declarations

Posts   
 
    
Dmeierotto
User
Posts: 10
Joined: 30-Jul-2004
# Posted on: 01-Aug-2005 18:44:47   

I noticed that the Extended Entity Templates create in the "Class Property Declarations" region Properties that shadow the ones in the Base classes. I must not be understading something, why are these needed here?

These gen'd properties are causing some issues for me because I wanted to gen the Extended entities classes just once, but if relations change in my db I also have to re-gen these extended objects because of the relations. This is very tedious because I have to be careful so that custom code in the sub-classes doesn't get overwritten.

Thanks!

-Dan

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 01-Aug-2005 22:00:19   

The properties are shadowed because they're declared static/shared. You can't override a static property as it can't be marked virtual.

This means that the prefetch paths properties have to be shadowed.

The reason the properties which are mapped onto a relation are shadowed is because they return now a different type, My<entityname>Entity, instead of <entityname>Entity. You can't achieve this by inheritance unfortunately.

To be sure your code is preserved, place your code in the usercode regions. These regions are preserved and not overwritten.

Frans Bouma | Lead developer LLBLGen Pro
Dmeierotto
User
Posts: 10
Joined: 30-Jul-2004
# Posted on: 01-Aug-2005 22:32:22   

Do I even need these properties? Could I strip everything out of the "Class Property Declarations" in templates so I am gen'ing classes with only the constuctors?

Dmeierotto
User
Posts: 10
Joined: 30-Jul-2004
# Posted on: 01-Aug-2005 23:23:37   

Nevermind.... Now I see why these are needed. I made a mistake when updating the templates. flushed

Thanks!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39786
Joined: 17-Aug-2003
# Posted on: 02-Aug-2005 08:29:09   

Ok simple_smile

Besides that, if possible, try to store your own code in include templates, which are included into your entity classes at generation time. This way, you can preserve your code without the least amount of hassle.

Frans Bouma | Lead developer LLBLGen Pro