Thanks we achieved it (eventually) using the Factory Support Facility and
fluent interface like so:
WindsorContainer.AddFacility<FactorySupportFacility>();
WindsorContainer.Kernel.Register(
Component.For<ISession>()
.UsingFactory((ISessionManager sm) => sm.OpenSession()))
Very simple in the end, but as ever "easy when you know how"
Out of interest, can you explain why the SubDependencyResolver is a better
approach and do you have any references that explain the parameters passed
to the CanResolve and Resolve methods?
Cheers!
2009/9/3 Tuna Toksoz <[email protected]>
> Better idea!
>
> Tuna Toksöz
> Eternal sunshine of the open source mind.
>
> http://devlicio.us/blogs/tuna_toksoz
> http://tunatoksoz.com
> http://twitter.com/tehlike
>
>
>
>
> On Thu, Sep 3, 2009 at 8:27 PM, Jason Meckley <[email protected]>wrote:
>
>>
>> or your own implementation of SubDependencyResolver
>>
>> class SessionResolver : ISubDependencyResolver
>> {
>> private readonly IKernel kernel;
>>
>> public SessionResolver(IKernel kernel)
>> {
>> this.kernel = kernel;
>> }
>>
>> public object Resolve(...)
>> {
>> return kernel.Resolve<ISessionManager>().OpenSession();
>> }
>>
>> public bool CanResolve(...)
>> {
>> return typeof(ISession).IsAssignableFrom
>> (dependency.TargetType));
>> }
>> }
>>
>> On Sep 3, 8:52 am, Tuna Toksoz <[email protected]> wrote:
>> > using Factory Support facility.
>> >
>> > Tuna Toksöz
>> > Eternal sunshine of the open source mind.
>> >
>> >
>> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
>> >
>> > 2009/9/3 DannyT <[email protected]>
>> >
>> > > I'm trying to use Rhino.Security which has a dependency on ISession.
>> > > However when using NHibernateFacility we only have an ISessionManager
>> > > registered in the container. Can anyone suggest how to get ISession
>> > > registered in the container from the ISessionManager? Or alternatively
>> > > somehow tell ISession to reference ISessionManager.OpenSession()?
>>
>>
>
> >
>
--
http://danny-t.co.uk
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---