【发布时间】:2010-10-14 18:58:58
【问题描述】:
我一直在使用 Unity 做一些 AOP 的东西,通过 IOC 进行设置,例如:
ioc.RegisterType<ICustomerService, CustomerService>()
.Configure<Interception>().SetInterceptorFor<ICustomerService>(new InterfaceInterceptor());
... 然后在 ICustomerService 接口的方法上有一个 ICallHandler。目前我只想获取调用的方法、它所在的类以及该类的命名空间。所以...里面...
public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
...ICallHandler 的方法,我可以通过 input.MethodBase.Name 访问方法名称...如果我使用 input.MethodBase.DeclaringType.Name 我得到接口 ICustomerService...但是...如何我去获取实现类“CustomerService”而不是接口?
有人告诉我使用 input.Target.. 但它只会返回“DynamicModule.ns.Wrapped_ICustomerService_4f2242e5e00640ab84e4bc9e05ba0a13”
对这些人有帮助吗?
【问题讨论】:
标签: c# .net inversion-of-control unity-container aop