Repeated methods in different classes

Posts   
 
    
Richardjjs
User
Posts: 14
Joined: 06-May-2007
# Posted on: 08-May-2007 08:40:40   

When i was working with OOPs in Vsual foxpro as long ago as 8 years!! We set uo our class libraries in a different way.

We sub Classed every Object and conrol - and then statred from there

If we take, for instance, the Entity Classes I think i would have had a parent class controlling them all.

When I had a method such as public string DisplayName { get { return this.LastName + "' " + this.FirstName;}

    }

I would have made it Protected Virtual in the parent Class i would have then only have had to call it once

If had wanted to include the initials I would have overriden the Class

Obviously the code would be different in VRP but why woul I not do the same in a LLBLGEN project Apart from the fact that there is no Parent Class for the Classes created by LLBLGEN

Richard

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 08-May-2007 08:56:39   

why woul I not do the same in a LLBLGEN project Apart from the fact that there is no Parent Class for the Classes created by LLBLGEN

There is a parent class.

Option #1: The parent class for all the entit classes is the EntityBase class, which is built into the SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll, and you have the source code of it shipped with the tool, so you can modify it and re-buld them.

Option #2: Use the TwoClass scenario when you generate the code to have a parent class for each entity class.

Option #3: You can modfy the code generation tamplates, you can a new template binding to generate a parent class for all the entities or for each entity.

Richardjjs
User
Posts: 14
Joined: 06-May-2007
# Posted on: 08-May-2007 09:10:11   

Thanks

Now ive just got to work out how to do it!!

R