RegisterType 不在 Autofac 2.3.2 中?
使用 AutoFac 2.3.2,我尝试执行以下操作:
var builder = new Autofac.ContainerBuilder();
builder.RegisterType<SomeDependency>().As<IDependency>();
RegisterType 不存在。没有通过智能感知看到它,编译器不知道它在那里。查看帮助表明RegisterType方法是一个扩展方法。我有什么遗漏的吗?为什么这个扩展方法没有出现?
我正在使用 VS2010,在测试项目和 Web 应用程序项目中尝试上述代码。
Using AutoFac 2.3.2, I am trying to do the following:
var builder = new Autofac.ContainerBuilder();
builder.RegisterType<SomeDependency>().As<IDependency>();
RegisterType is not there. Not seeing it with intellisense, compiler doesn't know it's there. Looking in the help shows that the RegisterType method is an extension method. Is there something I'm missing? Why is this extension method not showing up?
I'm using VS2010, attempting the above code in a test project and a web application project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用
use Autofac
或直接使用静态方法。或者
You need to use
use Autofac
or use the static method directly.or