LinFu动态代理生成 [英] Dynamic Proxy generation with LinFu

查看:117
本文介绍了LinFu动态代理生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为LinFu创建一个界面的动态代理。代理应该只是实现由接口定义的属性的getter方法,并返回一个字典中的值,其中的关键字是属性名。

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.

链接文本

推荐答案

尝试:

// 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...

这篇关于LinFu动态代理生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆