Events for IRepostiory to deal with non-content data

Topics: Customizing Orchard, General
Jan 23, 2014 at 8:00 AM
I'm looking for a way to register and trigger events for IRepository so that changes at Repositories level could be tracked for non-content data.

Basically i am working on a Groups module where roles are assigned to Groups. I need to keep track of when a role gets deleted. I guess i need some event mechanism which i could hook in Groups module for RoleRecord repository. I would be thankful for any ideas or suggestions in this regard.
Developer
Jan 23, 2014 at 4:25 PM
Edited Jan 23, 2014 at 4:29 PM
Check ISessionInterceptor interface. By implementing it you'll be able to hook into NHibernate pipeline.

The OnDeleted method seems like the place where you should put your logic in. Just check if the entity passed is of type RoleRecord and if it is - do your stuff. For other methods simply do nothing or return null if return value is required.