c# - CaSTLe 动态代理对象到原始对象的转换

标签 c# castle castle-dynamicproxy dynamic-proxy

 ProxyGenerator generator = new ProxyGenerator();
 var interceptor = new StandardInterceptor();
 MyInterfaceImpl test = (MyInterfaceImpl)generator.CreateClassProxy(typeof(MyInterfaceImpl), interceptor);

在上面的例子中,test对象是代理对象,假设它是由第三方创建的。

我无法传递给接受 MyInterfaceImpl 参数的 WCF 操作合约,因为它的类型不是 MyInterfaceImpl,而是 MyInterfaceImplProxy

如何将 test 对象转换为 MyInterfaceImpl 类型?请帮忙。

最佳答案

关于c# - CaSTLe 动态代理对象到原始对象的转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26442864/

相关文章:

c# - 在 .NET Core 项目中找不到 System.ServiceModel

c# - cosmos db 中的异步查询

c# - 如何在运行时用文本和图像填充 WPF 组合框

structuremap - 用结构图做拦截

c# - 如何在CaSTLe.Core中实现IProxyGenerationHook的类中实现Equals和GetHashCode的重写方法?

c# - MonoGame/XNA 在 Spritebatch 中绘制多边形

c# - 如何使用 CaSTLe Windsor - Fluent Interface 来注册通用接口(interface)?

c# - 如何从 List<T> 创建动态代理

.net - 如何改善 Windsor 3.0 的启动时间?

c# - 动态转换为通用类型