NHibernate Configuration Cache

20 views
Skip to first unread message

Dan

unread,
May 11, 2010, 9:13:55 AM5/11/10
to S#arp Architecture
Hi all,

There have been several posts regarding startup time and how long it
can take for NHibernate to initialize a session configuration. About
a week ago Sandor D. made a change to the NHibernateSession class and
mentioned an article by Ayende Rahien regarding caching the NH
configuration (http://msdn.microsoft.com/en-us/magazine/
ee819139.aspx). This prompted me to dig out some code from a previous
project based on the same article, and to work with Sandor to
incorporate his code into a configuration caching feature.

I've posted the new code at
http://github.com/sonomofo/Sharp-Architecture/commits/NHConfigCache.Injection.
If you are interested, please check it out and provide suggestions.

I do have several questions of my own about the code:
1) Location of the cache file. Some servers are locked down to allow
read-only access to the web applications files, so I chose a temp
folder, which points to the user account under which the web browser
is running. How would this be affected by running the app in IIS, in a
medium or low trust environment?
2) While I did add a unit test that adds a second database
configuration, and it does produce a second cache file, I don't know
how realistic of a test this is.
3) Is there any way to really unit test the actual creation of the
configuration cache file and if it can be deserialized and used
properly?
4) This has only been tested using WinXP SP3, Cassini Web Server,
VS.Net 2008 SP1, SQL Server 2008, .Net 3.5 SP1, but hey, what could
possibly go wrong!

Regards
Dan

--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To post to this group, send email to sharp-arc...@googlegroups.com.
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sharp-architecture?hl=en.

Dan

unread,
May 17, 2010, 10:49:13 AM5/17/10
to S#arp Architecture
Hi,

Now that Alex has applied this code into the master, everybody can use
it. I've written a wiki page describing the configuration cache and
how to use it.
http://wiki.sharparchitecture.net/NHibernate%20Configuration%20Cache.ashx

Please let me know if you have any questions
Dan

On May 11, 9:13 am, Dan <sonom...@gmail.com> wrote:
> Hi all,
>
> There have been several posts regarding startup time and how long it
> can take for NHibernate to initialize a session configuration.  About
> a week ago Sandor D. made a change to the NHibernateSession class and
> mentioned an article by Ayende Rahien regarding caching the NH
> configuration (http://msdn.microsoft.com/en-us/magazine/
> ee819139.aspx).  This prompted me to dig out some code from a previous
> project based on the same article, and to work with Sandor to
> incorporate his code into a configuration caching feature.
>
> I've posted the new code athttp://github.com/sonomofo/Sharp-Architecture/commits/NHConfigCache.I....

Alec Whittington

unread,
May 23, 2010, 4:36:05 PM5/23/10
to sharp-arc...@googlegroups.com
Dan,
    thanks for writing this up as well as supplying the enhancement.

Cheers,
Alec Whittington

Howard van Rooijen

unread,
May 23, 2010, 5:14:38 PM5/23/10
to sharp-arc...@googlegroups.com
+1 - thank you - it's a great addition.
Reply all
Reply to author
Forward
0 new messages