Thankyou so much!  Windsor is clearly even more subtle than I thought.
  I've got a basic version working now.  Each of the questions was a
different way of approaching the problem.  I initially thought that putting
interceptors into the model would solve the problem, but in practice Windsor
requires the implementing type (i.e. the target) to implement the interface.
 Trying to put proxy types into windsor caused it to fail when trying to
find the constructor, so I've implemented the feature using component
activators, which give me more direct control.
So far I've got the following tests working:

   - Basic functionality (it actually does something)
   - Passing in basic parameters
   - Passing in key parameters (i.e. reference a component by name rather
   than value)

The last one requires attributes, because the convention magic seemed a bit
too much.  I'd rather have a full convention-only approach, but you can't
have everything.

Things I know don't work:

   - Disposal
   - There's no diagnostics
   - Factories that return other factories.

On the last point, I've been following the discussion about the semantics of
additionalArgs with interest.  Adding in that level of control would
obviously make the factory code more predictable as well.  Ideally, the
interceptor could figure out which parameter belonged where in the base
case.

Thankyou again for your help, it's much appreciated.

J



2008/12/29 hammett <[email protected]>

>
> Ha, very interesting! I've spent a considerable amount of time on this
> problem space "factories implemented automagically by the container".
> You may bump into interesting problems.
>
> As for your questions. As interceptor are standard components, you can
> "depend" on IKernel, and an instance will be provided for you.
>
> > Is there a way to override the setting of a handler from within a
> facility?
>
> Yes. But why you want to do that?
>
> > Failing that, is there a way for a component activator to access the
> kernel?
>
> All activators are created using a conventional constructor which has
> the kernel as parameter.
>
>
> On Mon, Dec 29, 2008 at 9:57 AM, Julian Birch <[email protected]>
> wrote:
> > Hi, basically I'm trying to provide a nicer way of calling Resolve with
> > additional arguments.  The crucial code is the following:
> > public void Intercept(IInvocation invocation)
> >         {
> >             var arguments =
> ToArguments(invocation.Method.GetParameters(),
> > invocation.Arguments);
> >             var returnType = invocation.Method.ReturnType;
> >             var result = container.Resolve(returnType,
> > ToHashtable(arguments));
> >             invocation.ReturnValue = result;
> >         }
> > I'm finding it a bit hard to explain what exactly it's for, but it's
> > basically a way of using Windsor and dynamic proxy to auto-implement
> > abstract factories.  The basic code works, but what I'd like to do is to
> > allow these factories to be placed into the container they use.  This
> would
> > prevent the behaviour that you see occasionally of people registering
> > the Windsor container into itself.  Ideally, it would mean that the only
> > time you needed to take a dependency on Windsor was in the set up code.
> >
> > Thanks,
> > Julian
> > 2008/12/29 Ayende Rahien <[email protected]>
> >>
> >> Let us go back several steps, explain what you are trying to _do_.
> >>
> >> On Mon, Dec 29, 2008 at 6:46 PM, Julian Birch <[email protected]>
> >> wrote:
> >>>
> >>> Hi, I've got a little piece of code that uses a simple convention
> system
> >>> to proxy calls to Windsor.  I'll admit right now that I'm not on first
> name
> >>> terms with most of this code case.  I've been trying to turn the
> feature
> >>> into a facility that would be easy to use, but I've run into a couple
> of
> >>> snags.  I've got a couple of questions, sorry if they're obvious:
> >>>
> >>> An interceptor can be informed of the component model on behalf of
> which
> >>> it is acting.  Can it obtain any more information?  In particular, can
> it
> >>> get the kernel?
> >>> Is there a way to override the setting of a handler from within a
> >>> facility?
> >>> Failing that, is there a way for a component activator to access the
> >>> kernel?
> >>>
> >>> In general terms, it seems like my problem is that I need an instance,
> >>> but the system is designed to not pass this level of information
> around.
> >>> Thank you,
> >>> Julian
> >>>
> >>
> >>
> >>
> >
> >
> > >
> >
>
>
>
> --
> Cheers,
> hammett
> http://hammett.castleproject.org/
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to