I came across this ninject extension: 
https://github.com/ninject/ninject.extensions.namedscope#readme

It basically allows you to define a scoped lifestyle as part of the
container configuration. The windsor solutions I've seens define scope
when resolving instead. From the readme in that ninject extension:

  const string ScopeName = "ExcelSheet";
  Bind<ExcelSheet>().ToSelf().DefinesNamedScope(ScopeName);
  Bind<SheetPresenter>().ToSelf();
  Bind<SheetCalculator>().ToSelf();
  Bind<SheetDataRepository>().ToSelf().InNamedScope(ScopeName);

This basically says that for each excel sheet, any child dependencies
of the sheet that require a SheetDataRepository will get the same
instance of the SheetDataRepository.

I kind of like this solution because I can define the scope in the
installer rather than at resolve time. It also makes sticking to the 3
calls pattern easier because you can still only have a single resolve.

My questions is: is there already something like this for windsor, if
not, in theory could it be possible (I'd give it a go)?

-- 
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.

Reply via email to