Speeding up startup time for applications that use NHibernate

I just read a very cool NHibernate trick to let your application start faster that was mentioned by Ricardo Peres:

Configuration cfg = new Configuration().Configure();
IFormatter serializer = new BinaryFormatter();

using (Stream stream = File.OpenWrite("Configuration.serialized"))
{
   serializer.Serialize(stream, cfg);
}

...

using (Stream stream = File.OpenRead("Configuration.serialized"))
{
   cfg = serializer.Deserialize(stream) as Configuration;
}
  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta