tags:

views:

93

answers:

2

I saw it's possible to speed nh app with configuration serialization (e.g. http://www.lucisferre.net/post/2009/06/18/Speed-up-nHibernate-startup-with-object-serialization.aspx). Is it pssible to serialize nh configuration in medium trust env. ?

A: 

While it might be possible (you'd have to try), remember that configuration serialization makes the most sense for desktop applications, that are launched many times a day.

Web applications, on the other hand, are "started" (i.e. accessed for the first time) only once in a while, making serialization unnecessary.

Diego Mijelshon
my hosting provider seems to restart application every n minutes (at least application_start event fired). So it's problem for me.
tomaszkubacki
In that case, give it a try. If serializing gives you trouble (because of filesystem access, for example) but *deserializing* works, you can always serialize in your dev/build machine and deploy the serialized configuration.
Diego Mijelshon
Deserializing with Binaryformatter does not work in Medium trust. Anyway thx for response
tomaszkubacki
A: 

Even if you can't serialize it to a binary file, it is apparently still faster to load the configuration if all the config is contained within a single XML file. Something to do with serializing and concatenating multiple XML config files. I have not personally tried it but it is worth testing out.

Another approach would be to use FluentNH. It still generates XML streams on the backend, but I believe it doesn't write them out so there is no concatenation or file read steps.

Finally I believe Fabio is working on a built-in fluent configuration for NH3.0 which will not involve any XML serialization whatsoever.

http://fabiomaulo.blogspot.com/2010/02/conform-nhibernate-un-mapping.html

Chris Nicola