views:

25

answers:

2

By default, NHibernate compiles the mappings when creating the SessionFactory...

Is it possible to configure NHibernate so that it compiles the needed mappings "on the go"? So that it only compiles a mapping when it needs it?

The reason I'm asking is to work around the lenghty operation on start-up (of a winforms, well, AutoCAD application...)

+1  A: 

You can't add mappings to an existing session, you can only instantiate a new Session. A similar question was asked and answered here: http://stackoverflow.com/questions/702195/

anthony
Ok, so let's say I "add them" when initializing the SessionFactory. So at that point NHibernate knows about the mappings. Is there any way to postpone the actual compiling of the mappings?
Bertvan
+1  A: 

Not possible. A good way to speed up session factory creation is serializing/deserializing the configuration object to a file.

Here are some more ideas to speed this up (or at least reduce the perceived startup time)

Mauricio Scheffer