Then the only way anything but nhibernate can create it is with your
validating ctor and you can assume that anything instantiated by
nhibernate using the private ctor is valid because of this.
Sure maybe there are edge cases where you will, but there are edge
cases to everything in software engineering. >99% of the time, if you
have a public ctor that validates and a private ctor with no args for
NHibernate to use, your value objects will be in a valid state.
I take it this is because:
1) Validation never changes over time
2) Programmers are infallible
--
It is the mark of an educated mind to be able to entertain a thought
without accepting it.
Also, programmers are not infallible, but this is why we have unit
tests during development and staging areas before moving to
production.
Therefore, I stand by my statement that if you have a public ctor that
validates and a private ctor for NHibernate to use, and nothing else
touches the datastore, then >99% of the time your entities will be
valid when loaded from NHibernate.
Linq to SQL, EF, and NHibernate all require the empty ctor, so this is
a (small) problem that we have to tolerate.