Hi Thanks for reply. I am using v2.1.1 and there is no implementation of Hook Proxy.Hook(h => h.Service<ProxyNothingHook>()
Regards On Jul 13, 9:58 pm, Krzysztof Koźmic <[email protected]> wrote: > You don't register PGO, but you can configure all relevant aspects of > the proxy mechanism. > In trunk version of Windsor you can do: > > var interceptor = new ResultModifierInterceptor(5); > container.Register(Component.For<ResultModifierInterceptor>().Instance(interceptor), > Component.For<ProxyNothingHook>(), > Component.For<ICalcService>() > .ImplementedBy<CalculatorService>() > .Interceptors<ResultModifierInterceptor>() > .Proxy.Hook(h => h.Service<ProxyNothingHook>())); > > var calc = container.Resolve<ICalcService>(); > Assert.AreEqual(4,calc.Sum(2,2)); > > In version v2.1.1 something similar although you can provide hook only > as an instance IIRC. > Version 2.5 beta1 does not have it which is my omission. Beta2 and final > version will work like the sample above > > Krzysztof > > On 13/07/2010 9:53 PM, PB wrote: > > > > > I came across this article of your on Selecting which methods to > > intercept which shows an implementation of ProxyGenerationOptions with > > ProxyGenerationHook. I am using windsor container and register types > > as follow > > > IWindsorContainer container = new WindsorContainer(); > > container.Register( > > Component.For<IFoo>().ImplementedBy<Foo>(), > > Component.For<ILogger>().ImplementedBy<Logger>(), > > Component.For<LogInterceptor>().LifeStyle.Transient); > > > could you please indicate how can i register ProxyGenerationOptions > > using windsor container. Thanks > > >http://kozmic.pl/archive/2009/01/17/castle-dynamic-proxy-tutorial-par... > > > On Jul 10, 11:15 pm, Krzysztof Koźmic<[email protected]> > > wrote: > > >> using either IProxyGenerationHook, or IIntreceptorSelector > > >> Component.For<IFoo>().ImplementedBy<Foo>().Interceptors<SomeInterceptor, > >> SomeOtherInterceptor>() > > >> 2010/7/10PB<[email protected]>: > > >>> thanks. then how can i prevent a method from being intercepted for > >>> interfaces? > > >>> regards. > > >>> On Jul 9, 8:05 pm, Krzysztof Koźmic<[email protected]> > >>> wrote: > > >>>> You're mixing stuff up here. Attributes and being virtual are unrelated. > > >>>> Class components need to have methods virtual to be interceptable. > >>>> Interfaces are virtual by definition. > > >>>> You don't need attributes at all - just assign interceptor to the > >>>> component when registering it. > > >>>> Krzysztof > > >>>> On 9/07/2010 12:30 PM,PBwrote: > > >>>>> I use Windsor container for DI in my application. I want to implement > >>>>> interception and confused wether I'll have to change the existing > >>>>> implementation to use Dynamic Proxy to create objects so that they can > >>>>> be intercepted or is there a way to integrate with existing Windsor > >>>>> container. > > >>>>> Also how can I implement attribute based method interception? I don't > >>>>> want classes to be attributed with > >>>>> [Interceptor(typeof(LogInterceptor))] and then create virtual methods. > > >>>>> Ninject allows you to derive your attribute class from > >>>>> InterceptAttribute class and decorate methods for interception. > > >>>>> [AttributeUsage(AttributeTargets.Property|AttributeTargets.Method, > >>>>> AllowMultiple = false, Inherited = true)] > >>>>> public class LogAttribute : InterceptAttribute > >>>>> { > >>>>> public override IInterceptor CreateInterceptor(IProxyRequest > >>>>> request) > >>>>> { > >>>>> return request.Context.Kernel.Get<LogInterceptor>(); > >>>>> } > >>>>> } > > >>>>> Is it achievable with castle? > > >>>>> Thanks- 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 > >>> athttp://groups.google.com/group/castle-project-users?hl=en.-Hide quoted > >>> text - > > >> - Show quoted text -- 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.
