http://castleproject.org/container/facilities/trunk/nhibernate/index.html You can just inject ISessionFactory in your data access classes.
And I think that configuring Windsor correctly you can specify which ISessionFactory is injected in which DAO. On Tue, Apr 7, 2009 at 6:27 PM, rg <[email protected]> wrote: > > Hi, I'd like to use Castle Windsor (yes, I'm a newbie) in an already > existing project, but don't want to introduce any dependencies on > castle in my components. And I have a problem with NHibernate. Castle > framework has a NHibernate 'facility' that uses ISessionManager > interface for opening database sessions. Can I somehow use old > ISessionFactory as defined in NHibernate? How can Castle be used to > inject a proper ISessionFactory to my classes? Is it possible at all, > or am I forced to use ISessionManager? > And how about using multiple databases? With nhibernate or spring.net > I could configure several ISessionFactories, one for each database, > and inject them to appropriate components. With Castle Windsor I'm > expected to use singie ISessionManager and give each database an > alias. So effectively I have to inject two parameters - > ISessionManager and database alias. Why such design? > My goal is to have reusable components, not tied to particular IoC > container so they can be used with Castle, Spring.net or Unity. Please > help me deal with NHibernate in such case. > Thanks > Rafal > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---
