Dynamic Proxy generation with LinFu

1.6k Views Asked by At

I am trying to build a dynamic proxy for an interface with LinFu. The proxy should just implement the getter methods of the properties that are defined by the interface and return for instance a value from a dictionary, where the key is the property name.

link text

1

There are 1 best solutions below

0
On BEST ANSWER

Try:

// The interceptor class must implement the IInterceptor interface
var yourInterceptor = new YourInterceptor();
var proxyFactory = new ProxyFactory();
IYourInterface proxy = proxyFactory.CreateProxy<IYourInterface>(yourInterceptor);
// Do something useful with the proxy here...