This is a mirror of official site: http://jasper-net.blogspot.com/

Speeding Up NHibernate Startup Time

| Tuesday, April 6, 2010
One technique I use and posted on the NHUsers mailing list consists in serializing a previously-configured Configuration  to the filesystem and deserializing it on all subsequente starts of the application:

Configuration cfg = null;
IFormatter serializer = new BinaryFormatter();

//first time
cfg = new Configuration().Configure();

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

//other times
using (Stream stream = File.OpenRead("Configuration.serialized"))
{
cfg = serializer.Deserialize(stream) as Configuration;
}

Check it out for yourselves.

Read more: Development With A Dot

Posted via email from jasper22's posterous

0 comments: