Is it possible to set non-nullable C# primitives (int, Guid, DateTime,
etc.) do a certain value, within the class, and have NHibernate
persist a null value where the schema permits? For example, if a
foreign key value is an int and set to "-1", then detect this as an
unassigned value and send a DBNULL in instead of the true value.
My goal is to migrate away from my current code generator, to
NHibernate, but I still need to support some of our current
standards. Currently, we do not allow a negative or empty value (-1,
Guid.Empty, etc.) to be persisted. Instead, our DAL detects this and
substitutes a null value on any insert or update call.
On a side note, all of our current data objects initialize IDs to
either -1 or Guid.Empty to signify that they are new. It would be
great if NHibernate could accommodate this. Example:
int defaultInt = -1;
Guid defaultGuid = Guid.Empty;
DateTime defaultDateTime = DateTime.Parse("1/1//1900");
Thanks, in advance.
-- Greg D.
--
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en.