Autofac配置
我刚刚开始使用 Autofac,我正在尝试配置一个简单的注册,根据文档,这应该有效:
var builder = new ContainerBuilder();
builder.RegisterType<CurrentUserInfo>().As<ICurrentUserInfo>();
但我得到:
类型参数数量不正确
根据文档:
_containerProvider = new ContainerProvider(builder.Build());
但没有构建方法...
I am just starting with Autofac and I am trying to configure a simple registration, according to the docs this should work:
var builder = new ContainerBuilder();
builder.RegisterType<CurrentUserInfo>().As<ICurrentUserInfo>();
But I am getting:
Incorrect Number of type parameters
And according to the docs:
_containerProvider = new ContainerProvider(builder.Build());
But there is no Build Method...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
重新启动 Visual Studio..损坏的缓存或其他东西
Restarted Visual Studio..corrupted cache or something
确保您已引用
Autofac.dll
和Autofac.Configuration.dll
。Make sure you have referenced both
Autofac.dll
andAutofac.Configuration.dll
.