Adapter code generated with My Prefix ?

Posts   
 
    
Khurram
User
Posts: 198
Joined: 26-Nov-2011
# Posted on: 15-Feb-2012 12:14:35   

Hi, I am generating code using Adapter 2 file per entity settings, but along everything it is genrating some classes with "My" prefix in sub entities folder

Is it normal in Adapter template generation or something wrong.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Feb-2012 04:43:32   

Khurram wrote:

Hi, I am generating code using Adapter 2 file per entity settings, but along everything it is genrating some classes with "My" prefix in sub entities folder

When you generate code, you selected the Adapter.TwoClasses preset, which generates two classes per entity. See the docs:

Documentation wrote:

Adapter also comes in two variants: General and TwoClasses. The General variant, formulated in the General preset generates one class per entity. The TwoClasses variant generates two classes per entity: entityNameEntity, which contains the generated plumbing code and MyentityNameEntity, which derives from that class and which is for your business logic. The TwoClasses variant is this add-on, but now included in the standard templates shipped with LLBLGen Pro. All template groups are fully supported and have the same basic persistence options, however one template group can have more sophisticated persistence options than the other while the other template group might have more functionality on board for ease of use.

David Elizondo | LLBLGen Support Team
Khurram
User
Posts: 198
Joined: 26-Nov-2011
# Posted on: 17-Feb-2012 16:53:55   

Thanks for the response. So It means I have to use MyEntityNameEntity for everything rather EntityNameEntity.

Actually previously I was using EntityNameEntity classes to bind to controls or grids. Now in 2 preset I need to bind with MyEntityNameEntity.

If I am not wrong any business logic require for this entity will go to MyEntityNameEntity and because it inherits from EntityNameEntity it is also the same thing ?

Kindly describe if I am conceptually wrong here.

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Feb-2012 20:00:19   

Khurram wrote:

Thanks for the response. So It means I have to use MyEntityNameEntity for everything rather EntityNameEntity.

In theory, yes, but it's up to you. The base entity contains all you need to work, but if you have custom properties/methods/etc in the derived class, then you should use the derived class.

Khurram wrote:

Actually previously I was using EntityNameEntity classes to bind to controls or grids. Now in 2 preset I need to bind with MyEntityNameEntity.

Yes.

Khurram wrote:

If I am not wrong any business logic require for this entity will go to MyEntityNameEntity and because it inherits from EntityNameEntity it is also the same thing ?

Yes

Khurram wrote:

Kindly describe if I am conceptually wrong here.

My advice is: is you don't really need a derived class, don't use it, use the normal preset. I have worked many projects with no need of TwoClasses preset. If I need some custom code I add it to a partial class of the entity, that way I always use the same class. Also, in Adapter is more natural to put the business logic is some other kind of Business/Manager/Service classes, so the only custom code I have in entity partial classes is for custom properties and some methods related to the data inside the entity, not the logic of the business process. But, for some people the TwoClasses preset is very helpful, that why it's there.

David Elizondo | LLBLGen Support Team