BrunoJuchli / StaticProxy.Fody

Creating proxies at compile time.
16 stars 3 forks source link

What about static methods? #3

Closed dzmitry-lahoda closed 9 years ago

dzmitry-lahoda commented 9 years ago

E.g.

using System;
namespace Service
{
    public class MyClass
    {
        public static void WriteLine()
        {
            Console.WriteLine("Real class did this");
        }
    }
}
dzmitry-lahoda commented 9 years ago

StaticProxy better to support static classes because of name:)

Right now found https://github.com/Fody/Ionad

BrunoJuchli commented 9 years ago

Yes you're right you can use Ionad for that. Depending on your usecase you might also be able to leverage MethodDecorator.

I currently don't plan to add support for static methods. The way which StaticProxy.Fody works would make it very, very difficult to do so.

The only reason to use StaticProxy.Fody instead of Castle.DynamicProxy, Linfu Proxy or any other dynamic proxy is to use proxying on platforms which don't allow runtime-weaving (IL-Emit). For example IPhone's. However i have to admit that the project is currently not fully Xamarin compatible. Due to lack of interest of other parties i have suspended further development. If there would be someone wanting to use it and willing to test it, i would gladly finish the work.

Regarding the name: You're right it is somewhat confusing. I chose the name to clearly differentiate from DynamicProxy (which is dynamically created during compile time). But still you're right maybe i should look for a better name... what do you think about CompileProxy, WovenProxy? Do you have any suggestions? It should clearly indicate that it's not done "dynamically" during runtime...