ppittle / pMixins

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

Virtual Member Funcs should be wrapped for AOP at the method, not func level #27

Closed ppittle closed 10 years ago

ppittle commented 10 years ago

Current:

internal String PublicAbstractMethod()
{
       return PublicAbstractMethodFunc();
}

//In MasterWrapper Contructor
PublicAbstractMethodFunc = 
                            () => base.ExecuteMethod(
                                "PublicAbstractMethod", 
                                new List<Parameter>{},
                                () => _mixinInstance.PublicAbstractMethod());

Better:

internal String PublicAbstractMethod()
{
    return base.ExecuteMethod(
        "PublicAbstractMethod", 
        new List<Parameter>{},
        () => PublicAbstractMethodFunc());
}

//In MasterWrapper Contructor
PublicAbstractMethodFunc = () => _mixinInstance.PublicAbstractMethod();

This fix will allow the Virtual Funcs to be overloaded and AOP still work.