将 EFProf ( http://www.hibernatingrhinos.com/products/EFProf ) 与 ASP Boilerplate ( http://www.aspnetboilerplate.com/ ) 一起使用时遇到问题。
对于单元测试,ASP Boilerplate 使用 Effort ( https://github.com/tamasflamich/effort ) 来模拟内存中的数据库。
如果我在不添加对 EFProf 的引用的情况下运行单元测试,则测试运行正确(绿色)。
如果我添加初始化行:
HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();
在我的测试基础 ctor 或我的应用程序项目的 Initialize() 中,我收到以下错误:
Castle.MicroKernel.ComponentActivator.ComponentActivatorException
ComponentActivator:无法实例化 MyApp.EntityFramework.MyAppDataContext
内部异常有相关信息:
Error: Unable to cast object of type 'Effort.Provider.EffortConnection' to type 'HibernatingRhinos.Profiler.Appender.ProfiledDataAccess.ProfiledConnection'.
Effort 与 EFProf 不兼容吗?还是我在初始化时做了一些非常明显的错误?