I had a similar problem to solve. I ended up making an adapter to the unit of work which also holds a child kernel, and then tracks dependencies over the unit of work. (Note: I have long-lived units of work on my desktop client app).
I noted that Diego solved the problem in a similar way, and does a good job documenting it on Stackoverflow: http://stackoverflow.com/questions/6666043/castle-using-an-existing-not-single-instance-for-a-lower-level-dependency/6670566#comment9973816_6670566 -r On Fri, Dec 16, 2011 at 2:52 AM, Ramon Smits <[email protected]> wrote: > I am having a unit of work class. When initialized a new proxy > instance for connecting to a remote repository gets injected. This > unit of work then does several tasks that form the unit of work to be > performed. This tasks do several things and some tasks connect to the > same remote repository. It would be more efficient if these tasks > could share the same proxy while in the scope of the unit-of-work. I > think that this is supported by Windsor but I have not found any > example on how to configure such scenario's. > > For simplicity I mention a basic set of interfaces > > IRepository<X> > ITaskA > ITaskB > IUnitOfWork > IStuffToDo : IUnitOfWork > { > DoSomeMagicResponse DoSomeMagic(DoSomeMagicRequest request); > } > > classes: > > RepositoryProxy : IRepository<X> > { > } > > TaskA : ITaskA > { > IRepository<X> Repository; > } > > TaskB: ITaskB > { > IRepository<X> Repository; > } > > StuffToDo : IStuffToDo > { > IRepository<X> Repository; > Func<ITaskA> CreateA; > Func<ITaskB> CreateB; > } > > > > Any help is appreciated. > > -- > 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. > > -- 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.
