Hi all,
Im trying to get the two facilities, WCFIntegration and
NHibernateIntegration working together so that I can get one session
per wcf request. And I think I'm almost there, just one final hurdle
Im suffering with.
So Ive setup an SessionEndpointBehavior class which has
ISessionManager and IKernel dependencies. It generates a
SessionInstanceProvider like so:
public void ApplyDispatchBehavior(ServiceEndpoint endpoint,
EndpointDispatcher endpointDispatcher)
{
Type serviceType =
endpointDispatcher.ChannelDispatcher.Host.Description.ServiceType;
endpointDispatcher.DispatchRuntime.InstanceProvider = new
SessionInstanceProvider(serviceType, sessionManager, kernel);
}
SessionInstanceProvider implements IInstanceProvider and has the
following GetInstance method:
public object GetInstance(InstanceContext instanceContext,
Message message)
{
session = sessionManager.OpenSession();
kernel.AddComponentInstance(NHibernateSessionKey,typeof
(ISession),session);
return kernel[serviceType.FullName];
}
And lastly, Ive added the SessionEndpointBehaviour as a component in
my web.config. WindsorContainer is initialised in the global.asax
file.
The Wcf service markup references
Castle.Facilities.WcfIntegration.DefaultServiceHostFactory and the
class has an ISession dependency in the constructor.
Everything works, Getinstance() is called and a session is put into
the kernel.
However, my wcf service cant find the ISession dependency:
Can't create component 'WCFHost.TestService' as it has dependencies to
be satisfied.
WCFHost.TestService is waiting for the following dependencies:
Services:
- NHibernate.ISession which was not registered.
I see that SessionManager.OpenSession() returns a SessionDelegate
instance, but this implements ISession, so I dont understand why its
failing.
Im assuming that when I provide IKernel as a dependency to
SessionEndpointBehavior, castle is using the currently instantiated
windsor container, is that correct?
Any suggestions appreciated
Andy
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---