Thats correct. One the first request everything is fine, session is opened in the GetInstance, the wcfservice uses the session fine, then the ReleaseInstance closes the session. Upon execution of the 2nd request, a new session is created in the GetInstance, and its properties show IsOpen=true. But immediately breaking in the wcf service, the session.IsOpen=false.
Curiously I added a new guid to the customdependency in GetInstance, and included it on wcf service constructor. On the 2nd request, despite Getinstance generating a new guid and inserting it into the customdependency object, the wcf service received guid is still the origin. So is the Resolve<T>(type, dependency) not using the latest dependency collection? On 3 June, 15:00, Craig Neuwirt <[email protected]> wrote: > WCF Services are typically best handled as singletons > > On Wed, Jun 3, 2009 at 8:41 AM, Andyk <[email protected]> wrote: > > > Or alternatively, should a wcf service have a specific lifestyle? > > Maybe thats the issue. > > > On 3 June, 14:34, Andyk <[email protected]> wrote: > > > Thats dont it, its working, fantastic. > > > > Does the dependency object need to be disposed in a certain way. > > > Currently my ReleaseInstance method just calls session.close and then > > > session=null > > > However the session seems to permamently stay closed on any subsequent > > > requests? > > > > On 3 June, 13:07, Craig Neuwirt <[email protected]> wrote: > > > > > I think it would be more like > > > > session = sessionManager.OpenSession(); > > > > Hashtable dependencies = new Hashtable(); > > > > dependencies.Add("sessopm", session); > > > > return container.Resolve(serviceType.FullName, dependencies); > > > > > This assumes the serviceType ctor has an argument called session of > > type > > > > ISession > > > > > On Wed, Jun 3, 2009 at 3:52 AM, Andyk <[email protected]> > > wrote: > > > > > > ok I did the following in the InstanceProvider: > > > > > > public object GetInstance(InstanceContext instanceContext, > > > > > Message message) > > > > > { > > > > > session = sessionManager.OpenSession(); > > > > > Hashtable dependencies = new Hashtable(); > > > > > dependencies.Add(NHibernateSessionKey,session); > > > > > container.AddComponentProperties<string, Hashtable> > > > > > (NHibernateSessionKey, dependencies); > > > > > return container[serviceType.FullName]; > > > > > } > > > > > > but my service still returns an exception, NHibernate.ISession was > > not > > > > > registered. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
