This project is read-only.
Entity Event Handlers

Having entities listen to life cycle events is a desired requirement for this framework. Rapid team have now reviewed this functionality, and we have now included this into our latest build. With this functionality, your entities can listen to events that affects its life cycle (Update , Create , Delete , Load ). You can use event handlers to intercept CRUD and Load operation to further enhance your business logics or validation of your entities before commit.

The following attributes are used to mark a method defined within the entity as a listener to life cycle events.
  • OnUpdate : Intercepts Update operation before hitting the data store.
  • OnDelete : Inrtercepts Delete operations
  • OnCreate : Intercepts Create operations
  • OnLoad : Intercepts Load Operations

Update Interception Mapping Allows you to intercept update operations on Customer class , checks if the Orders collection of the customer class has any order, then rolls back.

    public partial class Customer
        .... other mappings 
        public virtual void OnUpdate( ActionEventArgs args )
            if ( Orders.Count > 0 )
                args.ActionState = ActionEventArgs.State.Rollback;

You can use other event attributes like the example above.

Last edited Feb 9, 2010 at 2:28 PM by ahmedsalako, version 9


No comments yet.