Search code examples
silverlightnhibernatehttpcontext

Nhibernate, two projects with different sessionfactories in silverlight, resolving the wrong one


I have a problem with the binding of the sessionfactory and working with two silverlight projects and two sessionfactories.

I have one "main-project" which works against one database that need to access a second database trough a wcf-service-call. The second project (backend) has its own sessionfactory for accessing the database.

My problem is that I bind the sessionfactory to the HttpContext with ManagedWebSessionContext.Bind(HttpContext.Current, _sessionFactory.OpenSession()) with all my regular service-calls but when i call the service on the backend-project I want to use the backend-sessionfactory. When I make this call i get the sessionfactory for the main-project instead of the on for the backend-project. How can i do that?


Solution

  • This was not a problem when we deployed to our testserver so it's seems to be a problem only if I run the projects in the same environment as I do in debug.