Interceptors not firing

17 views
Skip to first unread message

julianjelfs

unread,
May 3, 2013, 6:21:13 AM5/3/13
to castle-pro...@googlegroups.com
Hi, 

I have fairly recently upgrade to Castle 3.2.0 and almost everything is working correctly except that I have some interceptors that are not firing. As far as I can tell I have followed the docs. The registration code looks like this:

Classes.FromAssembly(typeof(ISafeAndSecure).Assembly).Where(
                    t => typeof (ISafeAndSecure).IsAssignableFrom(t))
                    .Configure(c => c.Interceptors(
                                       InterceptorReference.ForType<InboundCharacterRemovalInterceptor>(),
                                       InterceptorReference.ForType<SecureArmInterceptor>(),
                                       InterceptorReference.ForType<LoggingInterceptor>())
                                   .First.LifeStyle.Is(LifestyleType.PerWebRequest)
                    ).WithService.FirstInterface()

All of the components are resolved correctly but the interceptors do not fire. 

Other components registered individually with interceptors are fine and work correctly e.g.

Component.For<IResourcePreferencesService>().ImplementedBy<ResourcePreferencesService>()
                    .LifeStyle.Is(requestLifestyle)
                    .Interceptors(new InterceptorReference(typeof (PreferenceCachingInterceptor)))
                    .First

This one does not have a problem. 

Is there anything obvious wrong here?

I know I am declaring the InterceptorReference in a slightly different way in the top one (using generics), but I have tried it both ways and it still doesn't work. 

Thanks, 

Julian. 

Krzysztof Kozmic

unread,
May 3, 2013, 9:04:28 PM5/3/13
to castle-pro...@googlegroups.com
This looks correct to me. Service methods on those components should be intercepted.

Can you build a failing test?

-- 
Krzysztof Kozmic

--
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to castle-project-u...@googlegroups.com.
To post to this group, send email to castle-pro...@googlegroups.com.
Visit this group at http://groups.google.com/group/castle-project-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

julianjelfs

unread,
May 7, 2013, 4:14:17 AM5/7/13
to castle-pro...@googlegroups.com
OK - good to know I'm doing it right. I will try to come up with a simple failing test. Might be a little while till I get a chance. Will post back then.
Reply all
Reply to author
Forward
0 new messages