我有一个运行良好的应用程序,它使用 Windsor for IoC。我想记录对 Windsor 实例化的组件的所有调用的方法调用、参数和执行时间,所以我实现了一个实现 IInterceptor 的 LoggingInterceptor,它包含:
Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
invocation.Proceed(); // EXCEPTION IS THROWN HERE
sw.Stop();
Logger.Debug(.....
现在,以前运行良好的操作正在抛出带有以下消息的 VerificationExceptions:
方法 Repositories.RepositoryBase.GetAll:类型参数“ET”违反了类型参数“ET”的约束。
该方法的签名是:
public IList<ET> GetAll<ET>() where ET : EntityBase2, IEntity2
(其中 EntityBase2 和 IEntity2 来自 LLBLGenPro)
该方法的调用者如下:
public IList<ServerEntity> GetServers()
{
return GetRepository<IServerRepository>().GetAll<ServerEntity>();
}
(其中 GetRepository<>() 只是 ServiceLocator 的包装)
如果我从城堡配置中注释掉拦截器,一切都会再次正常工作。
为什么现在会发生这种情况,是否有修复程序以便我可以使用我的日志拦截器?
谢谢