I think you already mentioned the solution. You have to use a Singleton for the Sessionfactory-Provider. Personally I prefer to use Spring to manage my ApplicationContext an wire my objects but you don't have to.
Simply don't use the NbernatePersistencia-Object as a Service but as a SessionProvider and you are fine.
I think you already mentioned the solution. You have to use a Singleton for the Sessionfactory-Provider. Personally I prefer to use Spring to manage my ApplicationContext an wire my objects but you don't have to.
Simply don't use the NbernatePersistencia-Object as a Service but as a SessionProvider and you are fine. Your Service could look like this: public class YourService : IYourService { public User GetUsers(int id) { using(NOpenSession()) { return session. Load(typeof(user), id); } } } ...and for you SessionProvider i'd suggest to always open new sessions per request.
Long term sessions are slow and growing. Considering multiple users in a webservice this does not seem to be a good idea. Public class NbernatePersistencia { /* ... */ public ISession OpenSession() { return this.SessionFactory.OpenSession(); } /* ... */ } It's simple but should work.
Maybe you want to take a look at this NHForge-Example. The NbernateHelper there is pretty much like your NbernatePersistencia-Class.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.