Autofac 注入单个类型引发的BUG

在Register当中有以下代码:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
private void Register()
{
    ...
    _builer.RegisterType<BaseConnectionFactory>().As<IBaseConnectionFactory>().InstancePerLifetimeScope();
    ...
}
publi abstrct class BaseConnectionFactory
{
    //...other code...
}

注册之后提示异常信息:

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

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

Built with Hugo
主题 StackJimmy 设计