Hi

I would like to use the BoundTo Lifestyle in Windsor in conjunction with 
the TypedFactoryFacility where the factories maintain their scoped context. 
However I note that this is currently not supported (
https://groups.google.com/forum/?fromgroups#!topic/castle-project-users/txDi3dZ8veQ<../?fromgroups#%21topic/castle-project-users/txDi3dZ8veQ>).
 
Can someone explain how I can achieve this, perhaps there is a different 
way to do the same thing in Windsor? 

I have a scenario similar to the following. In which I am using a Command 
to add new Panels to a Workspace where I want the same instance of 
ISomeScopedViewModel to be injected into each Panel I add (created by the 
factory IWorkspacePanelViewModelFactory).

Scenario:

_container = new WindsorContainer();

_container.Kernel.AddFacility<TypedFactoryFacility>();

_container.Register(
   
Component.For<IWorkspaceViewModel>().ImplementedBy<WorkspaceViewModel>().LifeStyle.Is(LifestyleType.Transient),
   
Component.For<ISomeScopedViewModel>().ImplementedBy<SomeScopedViewModel>().LifeStyle.BoundTo<IWorkspaceViewModel>(),
   
Component.For<IWorkspacePanelViewModel>().ImplementedBy<WorkspacePanelViewModel>().LifeStyle.Is(LifestyleType.Transient),
   Component.For<IWorkspacePanelViewModelFactory>().AsFactory()
        ...
);

Original question on Stackoverflow: 
http://stackoverflow.com/questions/10195895/using-the-boundto-lifestyle-in-windsor-in-conjunction-with-the-typedfactoryfacil


-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/castle-project-users/-/uPvmQJtgRmEJ.
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.

Reply via email to