Virtual Properties

Posts   
 
    
thomas
User
Posts: 24
Joined: 21-Oct-2004
# Posted on: 16-May-2006 01:53:50   

Probably because I havent worked with llblgen in a while I'm puzzled by this. Why are the properties of an entity object scoped as virtual (Adapter Scenario). Doesnt that mean I have to implement them as public somewhere else to be able to see them or what am I missing? Its not a beta issue it?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 16-May-2006 03:57:24   

The virtual keyword is used to modify a method, property, indexer or event declaration, and allow it to be overridden in a derived class. So these properties can have a different implementation in derived classes.

thomas
User
Posts: 24
Joined: 21-Oct-2004
# Posted on: 16-May-2006 04:52:27   

Thank you for that. I had no idea! But seriously - what is the intent in making the properties virtual? Frans - feel free to jum in. Is the idea to build a 2 class scenario as a best practice? I remember about a year or two ago there was a discussion of that approach possibly being the best.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 16-May-2006 08:32:34   

As Brian (bclubb) says: to have them virtual, you can have a derived class and override them in that derived class and change hte meaning of the property or add code to the property via that override simple_smile

Frans Bouma | Lead developer LLBLGen Pro
thomas
User
Posts: 24
Joined: 21-Oct-2004
# Posted on: 16-May-2006 17:35:09   

Ok - it seems I'm not expressing myself properly. Let me go and get more coffee ... In the meantime thanks .

JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 22-May-2006 15:45:23   

thomas wrote:

Probably because I havent worked with llblgen in a while I'm puzzled by this. Why are the properties of an entity object scoped as virtual (Adapter Scenario). Doesnt that mean I have to implement them as public somewhere else to be able to see them or what am I missing? Its not a beta issue it?

Are you possibly thinking of "override"?

[Edit] Yuck! I meant to say "abstract".