Order
and child OrderItem
:Register
method:var hooks = new Hooks();
and hooks.Register();
.INSERT
or UPDATE
, the commit hooks will check if the reference to the database object is set properly. If not, then it throws an exception and prevents the item from being updated or saved to the database.BeforeDelete
commit hook, you can use the Starcounter method OnDelete
.OnDelete
works similar to the OnData
and HasChanged
callback methods that are explained on the callback methods page. It executes some code every time an instance of that class is deleted.Foo
and then delete it by calling fooInstance.Delete()
we would run CalledWhenInstanceIsDeleted()
.