开发者

RegisterType not in Autofac 2.3.2?

Using AutoFa开发者_运维知识库c 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.


You need to use use Autofac or use the static method directly.

use Autofac;
namespace X
{
   builder.RegisterType<MyType>();
}

or

Autofac.RegistrationExtensions.RegisterType<MyType>(builder);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜