【问题标题】:Dynamic Proxy generation with LinFu使用 LinFu 生成动态代理
【发布时间】:2010-09-30 17:35:18
【问题描述】:

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

link text

【问题讨论】:

    标签: c# dynamic proxy linfu


    【解决方案1】:

    试试:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 2015-04-04
      • 2017-06-06
      • 1970-01-01
      • 1970-01-01
      • 2011-04-02
      相关资源
      最近更新 更多