Concurrency in adapter model

Posts   
 
    
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Jan-2005 20:03:21   

When I used the self-servicing model, I overrode Update() in my derived entity class. Now I am using the adapter model, so I'm not sure where I would put this kind of code. I realize that when I save my POEntity object with adapter.SaveEntity(), I can construct and pass an IPredicateExpression, but the POEntity has a child collection and I want to save these also (and check for concurrency problems).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 27-Jan-2005 20:34:41   

You should use an IConcurrencyPredicateFactory implementation. You can inject these into entities in a derived class of an entity's factory class.

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 27-Jan-2005 20:50:04   

Otis wrote:

You should use an IConcurrencyPredicateFactory implementation. You can inject these into entities in a derived class of an entity's factory class.

Ok, the manual talks about using the IConcurrencyPredicateFactory in the adapter scenario, but is a little shy about telling me how to go about "injecting into entities in a derived class of an entity's factory class". Can you point me to proper section of manual o helpful thread?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 27-Jan-2005 21:39:42   

It comes down to creating a derived class of the entity factory, override the create methods and add the particular IConcurrencyPredicateFactory to the entity created by the base class' Create methods.

It's then wise to use the factory always, also for new single entities. You can also create a generic factory class for an entity (generate this using a template), and add the IConcurrencyPredicateFactory implementation there, which gives you a single point of where the IConcurrencyPredicateFactory is inserted into the entity.,

Frans Bouma | Lead developer LLBLGen Pro