Hey jnapier,
I had the same sort of problem. The way I resolved it was to add an interface to my entities (IEntity) which had a property SaveRequested.
Code:
public interface IEntity
{
bool SaveRequested
{
get;
set;
}
}
When the user calls the Update or Save methods of my repository I set SaveRequested = true, execute the Save()or Update() and then set SaveRequested = false.
I then added an interceptor and imlemented a check in the FindDirty callback to check whether the entity that arrived had the SaveRequested flag true - if it didn't then I return an empty int[] as specified in the Hibernate docs.
Code:
public int[] FindDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, NHibernate.Type.IType[] types)
{
if(((IEntity)entity).SaveRequested)
return null;
else
return new int[] {};
}
I found that it works fine as long as you call Save() or Update(), but not SaveOrUpdate(). Not sure why. Anyway, the net result was that no objects are saved other than the ones that I explicitly specify I want saved.
If you don't want your consumers to see the SaveRequested flag jsut implement it as an explicit interface.
Cheers,
Symon.[/code]