Idea for extracting entity interface

Posts   
 
    
knez
User
Posts: 37
Joined: 01-Nov-2004
# Posted on: 03-Nov-2004 17:06:08   

I read a couple of threads concerning low coupling between layers etc. Maybe someone already discussed this idea already, but I have to give it a shot.

I will be using adapter scenario (I am new to LLBLGen Pro world) and I was thinking of not exposing complete Entity classes to GUI. My plan is to extract interface (for each) entity that contains all events and public properties that Entity classes already implement and to set each Entity class to implement interface (i.e. CustomerEntity : ICustomerEntity, ....). In addition, each interface has one extra method for Validate.

I constructed my templates for code generation. By doing this, I get three projects generated: two projects generated as before for adapter (with mentioned changes for Entity classes), and one with just interfaces. In templates I even change return types from EntityCollection to IList and do casting where it is needed. This way, BL public methods don't show anything that is "LLBLGen Pro specific", and client is unaware of what is behind.

I am looking for anyones opinion about this idea. Are there any "gotchas" I have overlooked?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 03-Nov-2004 17:51:49   

Sounds good, the only advice I can give you is: work with derived classes and thus make your templates generate code which are derived classes, not the entity classes of the shipped templates. This means that when a template update is released, you don't have to update your templates also simple_smile

You can then base your templates on teh derived classes templates available in the 3rd party section in the customer area.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 1
Joined: 25-Jan-2007
# Posted on: 02-Feb-2007 13:07:14   

Did you come forward with this task. I would be extremely interested in the templates you generated as I have the same task.

Regards, Graham