【发布时间】:2014-11-06 19:59:56
【问题描述】:
我已将 FrameLog 添加到我的 MVC EF6 代码第一个项目中,但在运行它时出现错误:
Error activating ILoggingFilterProvider using conditional implicit self-binding of ILoggingFilterProvider
Provider returned null.
Activation path:
4) Injection of dependency ILoggingFilterProvider into parameter filterProvider of constructor of type GGContext
3) Injection of dependency GGContext into parameter context of constructor of type TillService
2) Injection of dependency ITillService into parameter tillService of constructor of type BankingController
一切都按照指南设置,我的上下文现在有 filterProvider 参数:
public class GGContext : DbContext
{
public GGContext(ILoggingFilterProvider filterProvider = null)
: base("name=myconnn")
{
Logger = new FrameLogModule<ChangeSet, Employee>(new ChangeSetFactory(), FrameLogContext, filterProvider);
....
我认为错误与将上下文注入服务类中的构造函数有关:
private readonly GGContext _context;
public TillService(GGContext context)
{
_context = context;
}
我需要改变什么来修复它?
更新
根据接受的答案,我得出结论,FrameLog 对我的需求来说太过分了,并且需要比我准备做的更多的更改。因此,虽然答案不能直接解决问题,但它让我意识到我需要一个不同的解决方案。
我使用 EF 中的 ChangeTracker 属性实现了解决方案,如 this answer by @VAAA 中所述
【问题讨论】:
标签: asp.net-mvc logging dependency-injection ninject