Autofac相当于Ninject的Get()

时间:2013-09-27 22:14:10

标签: dependency-injection ninject autofac

与Ninject相同的内容.Get()bein Autofac?

  Type handlerType = typeof(IMessageHandler<>);
            Type[] typeArgs = { message.GetType() };
            Type constructed = handlerType.MakeGenericType(typeArgs);
            var handler = NinjectKernel.Get(constructed);

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以使用:

IContainer.Resolve(Type)