[DP] Add Type Wrapping
Type Wrapping would allow to wrap a type with another type (without inheriting from it) and mimic it's public interface (without overriding it) to add dynamic proxy capabilities to sealed methods/classes. This would work with scenarios that don't rely on the actual type, like WPF data binding or C# 4.0 dynamic.
This might get implemented as part of v4, depending on time.
I was doing the prototype based on the Moq framework. I have to port it to Castle Dynamic Proxy.
Interesting approach, however with the amount of C++/COM, the fact that only one profiler can be attached at the same time IIRC (stops tools like dotTrace) and that you need to be an administrator, I don't think many people would consider this as an alternative to Reflection.Emit. Have you uploaded your prototype so people can learn from your work?
I prototyped an interception based on the .NET profiler-API. The you can just leave the whole type info. The profiler-API allows to modify ILCode when the method is jitted.
The main difference is that wrapping would not be inheritance based. This is something that is not currently possible with Dynamic Proxy. This gives it some great powers, but also limits it to non-type based scenarios (WPF databinding, ASP.NET MVC controllers, C# 4.0 'dynamic' etc).
Is this kind of like
http://bugsquash.blogspot.com/2009/05/duck-typing-with-castle-dynamicproxy.html ? I know my implementation is just a quick hack... but if that's the idea, wouldn't a proper interceptor implementation (handling of generics, caching, etc) suffice?