zony.me

Autofac 注入单个类型引发的BUG

在Register当中有以下代码:

C#
private void Register()
{
    ...
    _builer.RegisterType<BaseConnectionFactory>().As<IBaseConnectionFactory>().InstancePerLifetimeScope();
    ...
}
publi abstrct class BaseConnectionFactory
{
    //...other code...
}

注册之后提示异常信息:

Autofac.Core.DependencyResolutionException:“No constructors on type 'PDL.DoubleCenter.Infrastructure.BaseConnectionFactory' can be found with the constructor finder 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder'.”

之后查阅相关资料无果,之后尝试将abstrct取消之后正常注册。

Autofac 注入单个类型引发的BUG
作者 Zony · 发布于 2017-07-22
Licensed under CC BY-NC-SA 4.0
← 上一篇在你的 C# 项目当中集成对 LUA 的动态解析支持下一篇 →将指定实体序列化为 XML 文档