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, PB wrote:
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
--
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.