How To: OnBeforeEntitySave Overload

Posts   
 
    
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 09-Dec-2005 20:32:10   

I've looked in the docs "Generated code - DataAccessAdapter Functionality, Adapter" and down at the bottom it talks about "Intercepting activity calls" like the OnBeforeEntitySave method. It then goes on to say that I should overload these methods in the generated entity classes. No problem, but what would the code look like there? How do I overload methods in the EntityClasses which are exposed from the DataAccessAdapterBase? Is it an event that fires inside the entity that I'm looking for?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Dec-2005 11:27:05   

It's a method which is called right before the entity is actually saved and after it's been picked from the save queue. It's the last moment you have to do something with the data of the entity, like adding auditing stuff. You override that method in a derived class of the DataAccessAdapter class.

Frans Bouma | Lead developer LLBLGen Pro
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 12-Dec-2005 17:36:55   

Otis wrote:

You override that method in a derived class of the DataAccessAdapter class.

Why do you recommend this over placing my own code inside of the "user code regions" that you have set up? Only because I've written enough code with the "stock" one that going back and using the overloaded one would be somewhat of a hassle.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 12-Dec-2005 18:42:36   

The method IS in the DataAccessAdapterBase class, so you have to override it there. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 12-Dec-2005 20:22:35   

oh, duh! Hadn't had the coffee yet when I asked that question. confused