I am new to ActiveRecord on Castle (I come from Rails), so I
appreciate a little insight into something that may be basic.

I use OnSave to apply some simple domain rules to my objects before
persisting; salt password, set timestamps, etc.  Looking at NH Prof it
appears this causes Insert and Update queries to be fired.  The values
set prior to OnSave are persisted with NULLs set for everything else.
The Update then fires and sets the values from the OnSave method.

When one of the fields that is set in OnSave is not nullable in the
database an exception occurs.

I also played around with BeforeSave to see if I could get that to do
I would like.  While it did insert the row correctly (hooray), an
update is still generated and it appears to pass in a null value on
one of the non-nullable fields and an exception is thrown because of
it.

I am using the ActiveRecord 3.0 beta that is on Nuget.

Any insight into how I can accomplish setting all of these fields in
one Insert, would be awesome.  Thanks for your time.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to