Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:1.2 BETA
Hi. Can I use interceptors to call methods of my entities. Somthing like:
Code:
class fooManager : IMyInterceptor
{
//attributes and properties
private void OnSave()
{
if(foo.Parent == null)
throw new Exception("foo must have a parent");
foo.SomeDate = foo.Parent.OtherDate;
...
...
}
and use nHibernate interceptor:
Code:
public bool OnSave(object entity, object id, object[] state, string[] propertyNames, NHibernate.Type.IType[] types)
{
//invoke object.OnSave()
}
So, I can do some logic every time I save an object.
Is this ok, a bad idea....?