问题
Does Spring.NET have any support (integration) with NHibernate that would eneble per request ISession and transactions?
I foung this blog, but it is a bit old one so I want to know if things have moved forward a bit and may be this is already integrated in Spring framework and I can only set it up with some configuration?
回答1:
Yes it has, it's called "open session in view". Transaction support is available too, but it's not automatically "one transaction per request".
I think a good place for you to start would be the NHibernate quickstart in the Spring documentation. Both concepts are explained there.
Only just noticed the asp.net MVC tag; I think it should work, but I'm not quite sure. If you're using asp.net MVC 3, you should use Spring 1.3.2, which is due to release soon.
来源:https://stackoverflow.com/questions/6691506/spring-net-nhibernate-session-transaction-per-request