Hey,
I like to do custom actions when I save an object. For instance:
I got following object:
class Document
{
public GUID UID
{
get;
set;
}
public IOResource
{
get;
set;
}
}
When I save the Document the IOResource is saved also, normal NHibernate usage. Now if you save IOResource something has to be writen to the filesystem on base of the IOResource UID. So IOResource needs to be saved first so that NHibernate fills in its UID and then I want to save something to the disk. Is this possible (with an Nhibernate Event or a special interface) otherwise I have to make separate objects for my DataLayer and DomainModelLayer (wraps DataObjects)
If possible, can this be done in a transaction so that if the write to disk fails the creating of the object in the database is undone.
|