Generates the ILifecycle Interface

Topic updated 6-4-2007

This Template option is part of the Table Template Options and it has an important relation with the Validation Model.
 
Optionally, the templates can implement this interface which provides some callbacks that allow the persistent object to perform necessary initialization/cleanup. The following methods are added to the class: OnSave , OnUpdate , OnDelete , OnLoad

 
This option is by default turned OFF.

This option is also automatically turned OFF when the mapping Table has no primary key.

 
Example generated code in the POCO class:

public NHibernate.LifecycleVeto OnUpdate(NHibernate.ISession pSession)

{

       if(!this.IsValid)

               return NHibernate.LifecycleVeto.Veto;

       return NHibernate.LifecycleVeto.NoVeto;

}