OK
So.. this gets me a step nearer:
<code>
List<Type> registered = new List<Type>();
this.Register(
AllTypes
.Of<Controller>()
.FromAssembly(Assembly.Load("Irm.Web.App"))
.Configure(x =>
{
registered.Add(x.Implementation);
}));
foreach (var type in registered)
{
IHandler handler = this.Kernel.GetHandler(type);
if (type.IsAbstract) continue;
if (handler != null)
{
handler.ComponentModel.Interceptors.Add(new
InterceptorReference(typeof(LoggingInterceptor)));
}
}
</code>
It actually has some controllers in List<Type> registered - when it gets to
the foreach loop.
It still doesn't cause the interceptor to fire tho when any of these
controllers are loaded?
w://
On Fri, Apr 3, 2009 at 11:58 AM, Alexander Papanek <
[email protected]> wrote:
>
> Hi, I had a similar problem. Try something like this...
>
> // register controllers
> List<Type> registered = new List<Type>();
> Container.Register(
> AllTypes
> .Of<SmartDispatcherController>()
> .FromAssembly(typeof (Global).Assembly)
> .Configure(x => { // INFO: this syntaxt does not work
> /* InterceptorReference
> reference = new InterceptorReference(typeof (YourInterceptor));
> x.Interceptors(reference);*/
> registered.Add(x.Implementation);
> }));
> foreach (var type in registered)
> {
> IHandler handler = Container.Kernel.GetHandler(type);
> if(type.IsAbstract) continue;
> if(handler!=null)
> {
> handler.ComponentModel.Interceptors.Add(new
> InterceptorReference(typeof (YourInterceptor)));
> }
> }
>
>
>
> On Fri, Apr 3, 2009 at 10:40 AM, Wayne Douglas <[email protected]>
> wrote:
> > Yeah -all virtual - no logging - wierd.
> >
> > On Thu, Apr 2, 2009 at 6:21 PM, Jason Meckley <[email protected]>
> > wrote:
> >>
> >> the controller members are virtual, correct? if not this is definitely
> >> one reason it's not logging.
> >>
> >> On Apr 2, 11:18 am, Wayne Douglas <[email protected]> wrote:
> >> > Point regarding registering both types. Cheers for that :)
> >> >
> >> > I have l4n set up standalone and it's being used manually elsewhere in
> >> > the site ok.
> >> >
> >> > I have break points in the interceptor and they never get hit.
> >> >
> >> > w://
> >> >
> >> >
> >> >
> >> > On Thu, Apr 2, 2009 at 3:49 PM, Jason Meckley <[email protected]
> >
> >> > wrote:
> >> >
> >> > > isn't it redundant to put the interceptor or SmartDispatchController
> >> > > and Controller? one inherits from the other.
> >> > > Are your sure the problem is the interceptor and not the Logger?
> >> > > Are you utilizing the Logging facility that is part of castle? If so
> i
> >> > > think you need to add the facility before adding components.
> >> >
> >> > > On Apr 2, 9:57 am, Wayne Douglas <[email protected]> wrote:
> >> > >> Hi
> >> >
> >> > >> Can anyone spot anything wrong with this:
> >> >
> >> > >> <code>
> >> > >> IWindsorContainer container = new WindsorContainer();
> >> > >> container.Register(
> >> > >> Component.For<LoggingInterceptor>(),
> >> > >> AllTypes.Of<Controller>()
> >> > >>
> >> > >> .FromAssembly(Assembly.GetExecutingAssembly())
> >> > >> .Configure(c => c.Interceptors(new
> >> > >> InterceptorReference(typeof(LoggingInterceptor)))),
> >> > >> AllTypes.Of<SmartDispatcherController>()
> >> > >>
> >> > >> .FromAssembly(Assembly.GetExecutingAssembly())
> >> > >> .Configure(c => c.Interceptors(new
> >> > >> InterceptorReference(typeof(LoggingInterceptor))))
> >> > >> );
> >> > >> </code>
> >> >
> >> > >> All the controllers are loaded ok - but the interceptors never
> >> > >> happen...
> >> >
> >> > >> w://
> >> >
> >> > >> --
> >> > >> Cheers,
> >> >
> >> > >> w://
> >> >
> >> > --
> >> > Cheers,
> >> >
> >> > w://
> >>
> >>
> >
> >
> >
> > --
> > Cheers,
> >
> > w://
> >
> > >
> >
>
>
>
> --
> Alexander Papanek
> E-mail: [email protected]
> Mobile: +44 776 0443421
>
> >
>
>
--
Cheers,
w://
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---