BeforeSave and BeforeDelete event?

Posts   
 
    
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 12-Mar-2006 03:44:29   

I'm using entities generated by adapter template, entities have a AfterSave event, it is useful if I want to perform some procedure after entity is saved.

However, I want to have "BeforeSave" and "BeforeDelete" events too, I want to perform some caculation before entity is saved, and perform some procedures before entity is deleted.

Is it possible to add those two events?

Thank you very much!

sparmar2000 avatar
Posts: 341
Joined: 30-Nov-2003
# Posted on: 12-Mar-2006 05:05:25   

Hi Barry The following section in the manual describe methods of adding your ow code and should help you. Have a look at Using Generated Code --> Adapter --> Generated code - Adding your own code to the generated classes

Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 13-Mar-2006 02:36:20   

AfterSave event is from IEntity2 interface, I think it is not possible to add new event to the interface, and I cannot find where the code fire AfterSave event.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 13-Mar-2006 09:23:33   

More events are planned for v2 indeed.

Frans Bouma | Lead developer LLBLGen Pro
Barry
User
Posts: 232
Joined: 17-Aug-2005
# Posted on: 13-Mar-2006 15:36:31   

Will v2 have some virtual methods for overriding in entities like the following?

OnBeforeDelete OnBeforeSave OnBeforeTransactionCommit OnBeforeTransactionRollback OnBeforeXYZChanged OnAfterSave OnAfterTransactionCommit OnAfterTransactionRollback OnAfterXYZChanged

  • XYZ is a field

I think it is very useful to add some more BeforeXXX and AfterXXX event in both entity, entity collection and adapter.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 13-Mar-2006 19:48:59   

Which ones will be added isn't set in stone yet, but your list looks very good. We'll add events for the steps in the activity queues where users might want to intercept activity. THough if there's no valid scenario for an event, it's not added.

Frans Bouma | Lead developer LLBLGen Pro