我正在尝试为LinFu的界面构建动态代理。代理应该只实现接口定义的属性的getter方法,并返回例如字典中的值,其中键是属性名称。
答案 0 :(得分:5)
尝试:
// 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...