SelfService vs. Adapter (Web Services?)

Posts   
 
    
MikeG
User
Posts: 23
Joined: 17-Dec-2006
# Posted on: 20-Oct-2007 10:57:29   

Hi,

I am in the process of starting on a new project and am wondering if I ought to choose SelfService or Adapter paradigm.

Mostly, SelfService looks like it will work great with what I am doing, though something in the docs has me confused.

The docs say that for Web Services, I ought to use Adapter.

Can you please help me understand what this means? Will I not be able to attach web services to the SelfService model?

I would love to make the "right" choice here, because beginning with development to later find out I need to have chosen differently can be expensive.

Thank you much, Mike

Posts: 254
Joined: 16-Nov-2006
# Posted on: 21-Oct-2007 00:43:19   
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 21-Oct-2007 11:42:03   

Additionally to what Matt said: - if you want to transport entities over teh wire: adapter is the only option - if you want to transport ONLY DTO classes and all persistence stuff etc is encapsulated inside the webservice you can use both.

Frans Bouma | Lead developer LLBLGen Pro
MikeG
User
Posts: 23
Joined: 17-Dec-2006
# Posted on: 23-Oct-2007 02:59:40   

Thank you both for sending this. I very much appreciate the helpfulness of the LLBLGen community!

And I am still a bit confused by it. Can you please help me better understand?

  • if you want to transport ONLY DTO classes and all persistence stuff etc is encapsulated inside the webservice you can use both.

What is a DTO class?

Thanks Mike

MikeG
User
Posts: 23
Joined: 17-Dec-2006
# Posted on: 23-Oct-2007 03:13:58   

Ohh, I looked it up and found out what it is.

Data Transfer Object, a lightweight version of a full fledged Entity.

What would it mean to send an Entity over the wire? What is it about sending an Entity over that only the Adapter can handle?

And, can you please tell me if, other than the quicker initial development time, are there any other benefits to using the SelfService model?

I get the impression SelfService is very capable, but that somehow I might paint myself into a corner with it.

Is there anything SelfService does which Adapter cannot?

I'm still very wobbly with my LLBLGen...... Though am very excited about becoming much better and putting it to real use and service.

Thank you, Mike

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Oct-2007 06:24:35   

Hi Mike, hope this can help you to clarify a little the things:

LLBLGenPro wrote:

**SelfServicing **is about the paradigm that object persistence is something about the objects being persisted, so an entity object should know how to persist itself. SelfServicing's code is generated for one database type (e.g. Sqlserver / Oracle).

**Adapter **is about the paradigm that persistence is a 'service' provided by an object or group of objects and which is provided by logic outside the objects affected by the service.

LLBLGenPro wrote:

When to use which template group? Both template groups offer a wide set of functionality, but do that in a different way. This difference makes it important for you to know when to pick which template group for a given project. Below are two short lists which sum up some reasons for choosing each template group and which will help you with the decision which template group to take.

When to use SelfServicing

  • When the project targets a single database type.
  • When you are not using a distributed scenario like remoting or webservices.
  • When you need navigation through your object model in a databinding scenario and you want to load the data using lazy loading.
  • When you don't need to extend the framework.
  • When you like to have the persistence logic into the entity classes.
  • When you do not require fine grained database access control, like targeting per call another database.

When to use Adapter

  • When the project targets multiple database types or would be able to do that in the future.
  • When you are using a distributed scenario like remoting or webservices.
  • When you don't need lazy loading scenarios in relation traversals. You can still navigate relations but you have to fetch the data up-front.
  • When you need to extend the framework with derived classes.
  • When you like to see persistence logic as a 'service', which is offered by an external object (broker, adapter).
  • When you require fine grained database access control.
  • When you want to convert Entities to XML and back and performance and XML size are important.

Ref: LLBLGenPro Help - Concepts - Templates and Template Groups - Included template files.

I you want to learn more: LLBLGenPro Help - Using generated code - Adapter - Distributed Systems - XML Webservices / WCF support

David Elizondo | LLBLGen Support Team