Thanks for that - I think I'm about 80% of the way there now...

One issue remaining is that the values passed into resolve via the
dictionary are picked out according to name - is there anyway of
having them picked out according to type instead by registering a
custom resolver?

Rationale is that currently I just register a bunch of views on the
page and then create one or more presenters al off which have a
parameter named view ;-)

A naming convention seems a fragile direction to proceed in and would
also not work for some of my more complex pages which have 6 or more
presenters and views.

Paul

On Apr 7, 5:34 pm, Victor Kornov <[email protected]> wrote:
> private IPresenter InitializePresenter(object view)
> {
> IDictionary arguments = new Hashtable(1);
> arguments.Add("view", view);
>
> IPresenter presenter = IoC.Resolve<IPresenter>(_presenterType, arguments);
> presenter.Initialize();
>
> PresentersCache.Put(view, presenter);
>
> return presenter;
>
> }
>
> public abstract class Presenter<V> : IPresenter where V : class, IView
> {
> private readonly V _view;
> public V View
> {
> get { return _view; }
>
> }
>
> public Presenter(V view)
> {
> if (view == null)
> throw new ArgumentNullException("view");
>
> _view = view;
>
> }
>
> public void Initialize()
> {
> if (!_isInitialized)
> {
> InitializePresenter();
> _isInitialized = true;
>
> }
> }
>
> private bool _isInitialized;
> public bool IsInitialized
> {
> get { return _isInitialized; }
>
> }
>
> protected virtual void InitializePresenter()
> {}
>
>
>
> }
> On Tue, Apr 7, 2009 at 8:24 PM, Paul Hatcher <[email protected]> wrote:
>
> > German
>
> > Thanks, but I don't think it applies.
>
> > The issue as I see it is that as the web app is multi-threaded I can't
> > put anything into the container that I don't want all threads to see
> > and I also don't want Windsor to be responsible for the creation of
> > the views as they already exist.
>
> > What I want is something along the lines of..
>
> > container.Resolve<CustomerEditPresenter>(controller.ViewCollection)
>
> > where the container knows how to ask the passed value if it has any
> > dependencies that it might be interested in.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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