ppittle / pMixins

pMixins - Mixin framework for C#
http://pMixins.com
Apache License 2.0
23 stars 5 forks source link

Interceptors are not attached to virtual methods #4

Closed ppittle closed 10 years ago

ppittle commented 10 years ago
public partial class Mixin
{
    public virtual string GetHelloWorld()
    {
        return "Hello World - Updated";
    }
}

public class Interceptor : MixinInterceptorBase
{
    public override void OnBeforeMethodInvocation(object sender,     MethodEventArgs eventArgs)
    {
        eventArgs.CancellationToken = new CancellationToken
        {
            Cancel = true,
            ReturnValue = "Intercepted"
        };
    }
}

[pMixin(Mixin = typeof(Mixin), Interceptors = new[] { typeof(Interceptor) })]
public partial class Target 
{

}