Search code examples
dependency-injectionninjectautofac

Autofac equivalent of Ninject's Get()


What would the equivilant to to Ninject's .Get() be in Autofac?

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

Thank you!


Solution

  • You can use:

    IContainer.Resolve(Type)