using (Fluent) NHibernate with StructureMap (or any IoCC)
Posted
by Andrew Bullock
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Bullock
Published on 2008-12-20T16:08:12Z
Indexed on
2010/03/18
21:01 UTC
Read the original article
Hit count: 757
Hi,
On my quest to learn NHibernate I have reached the next hurdle; how should I go about integrating it with StructureMap?
Although code examples are very welcome, I'm more interested in the general procedure.
What I was planning on doing was...
- Use Fluent NHibernate to create my class mappings for use in NHibs Configuration
- Implement ISession and ISessionFactory
- Bootstrap an instance of my ISessionFactory into StructureMap as a singleton
- Register ISession with StructureMap, with per-HttpRequest caching
However, don't I need to call various tidy-up methods on my session instance at the end of the HttpRequest (because thats the end of its life)?
If i do the tidy-up in Dispose(), will structuremap take care of this for me?
If not, what am I supposed to do?
Thanks
Andrew
© Stack Overflow or respective owner