"Contract first" development, DTOs, mapping

Posts   
 
    
Posts: 19
Joined: 08-Jan-2007
# Posted on: 27-Mar-2007 12:17:20   

Hi

For our more complex apps, we develop using the "contract first" methodology, so we create the necessary "service contract" schemas then generate the business entities using something like XMLSpy, which will ultimately be passed between the presentation and business tiers.

LLBLGen however generates code bottom up (i.e. based on a database schema), and these don't necessarily match the business entity requirements for a "contract first" project. We therefore need some way of mapping our own service contract business entities to/from LLBLGen entities.

Writing and maintaining these mapping helper classes could get quite tedious in a large project, so I just wondered if anyone else has done this, or written their own code generator to create "mapping" classes? (If not then it looks like I'll have to roll my sleeves up and maybe in a few months time I'll be selling it to the LLBLGen community!)

Cheers

Andy

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 28-Mar-2007 08:15:34   

I have used the data map object in the CSLA framework to do this type of stuff. Maybe you could check that out.

Its a simple class that works on a source and target objects and transfers data from one point to the other.

Posts: 19
Joined: 08-Jan-2007
# Posted on: 28-Mar-2007 12:07:48   

I was thinking of more complex mappings where the properties of a single service contract entity are mapped to properties on one or more llblgen entities.

For example in a CRM system there might be a "CustomerCall" service contract business object which is made up of various llblgen entities such as customer, enquiry, contact details, call history, etc.

Walaa avatar
Walaa
Support Team
Posts: 14952
Joined: 21-Aug-2005
# Posted on: 28-Mar-2007 15:02:32   

For example in a CRM system there might be a "CustomerCall" service contract business object which is made up of various llblgen entities such as customer, enquiry, contact details, call history, etc.

That's pretty much application/domain specific.

What you can do is create you own code generation templates and let LLBLGen Pro generate the code for you.