you can alter the configuration before building the session factory.
something like
var cfg = new Configuration.Configure();
foreach(var mapping in cfg.GetClassMappings())
{
   foreach(var column in mapping.MappedColumn)
   {
         column .IsNotNull = true;
   }
}
var factory = cfg.BuildSessionFactory();

I have no idea if it looks anything like this, but you get the idea:
get the mappings, get the columns, mark them as not null.

I would agree with Fabio on this though. NH is designed to make
assumptions about the domain model (field access, data type), not the
database. (the result of persisting the domain to RDBMS).
I found making the shift from database to domain is difficult. You
still think in terms of "what does the database look like" how can i
query the database. Using NH you shift to "how do the entities/value
objects interact?" and "how cab I query the domain?".
It's not that you shouldn't care about the database, but the database
is not the core of the application, it's simply there to persist the
domain.

On Mar 8, 10:06 am, Fabio Maulo <[email protected]> wrote:
> Try to use not-null="true" as default in a Table-per-class-hierarchy and let
> me know in how many place you must write not-null="false"...
> but that is only an example.
>
> The DB is there only because we haven't find the way to ensure constant
> energy to our servers... the not nullable constraint is something you have
> in your domain-model you don't need it, always, in the DB.
>
> 2010/3/8 kor <[email protected]>
>
> > why do u think that is a bad thing to have not-null as default?
>
> > --
> > 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]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> Fabio Maulo

-- 
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.

Reply via email to