Two classes Vs Single class in templates

Posts   
 
    
Krish
User
Posts: 91
Joined: 02-Jan-2008
# Posted on: 05-Mar-2010 00:14:58   

Both the adapter and self-servicing has the option of one class or two classes when generating code. With .NET Frameweok 2.0 we have partial classes - does this make the two class option redundant? or is it there for convenience / backwards compatibility?

With the adapter pattern why do we need two classes, even before partial classes were available?

In version 3.0 (Beta) of LLBLGen do we still have the two class option?

I am using LLBLGen 2.6 Final.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Mar-2010 06:20:36   

If you want to inherit from base entity you can use TwoClasses, that way you can write custom code without lose the base code of the parent.

I always use General, and in VSNet I use partial classes, as I only want to extend the code. TwoClasses is more commonly used in SelfServicing as you can write your custom methods / overrides on you child. Of course, no needed if you plan to user partial classes.

David Elizondo | LLBLGen Support Team
Kodiak
User
Posts: 92
Joined: 13-Apr-2009
# Posted on: 16-Apr-2011 06:31:17   

Wouldn't it be easier to have the TwoClasses make use of Partial classes rather than inheritance?

If you use Inheritance for entities you then need to add the code into the BaseEntity class rather than the actual entity class.

Is there any easy way to make the TwoClasses option output as partial rather than inherited?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Apr-2011 07:16:48   

Kodiak wrote:

Is there any easy way to make the TwoClasses option output as partial rather than inherited?

No. If you want to use partial classes, just create the files. You could add a template that generates partial classes files for each entity en the General (one class) approach.

David Elizondo | LLBLGen Support Team