In Ninject i can configure a container like the mentioned below, What is the Autofac equivalent for the "Highlighted ones"?
Currently i am trying to achieve the same using AutoFac, any help is much appreciated.
public class NinjectAdapter : IContainerAdapter
{
private readonly IKernel _kernel;
public NinjectAdapter(IKernel kernel)
{
_kernel = kernel;
}
**public void Register(Type service, Type implementation)
{
_kernel.Bind(service).To(implementation);
}**
**public void Register(Type service, Type implementation, Type conditionType)
{
_kernel.Bind(service).To(implementation).WhenInjectedInto(conditionType);
}**
**public void Register(Type service, Type implementation, string named)
{
_kernel.Bind(service).To(implementation).Named(named);
}**
**public void RegisterSingleton(Type service, Type implementation)
{
_kernel.Bind(service).To(implementation).InSingletonScope();
}**
**public void RegisterInScope(Type service, Type implementation)
{
_kernel.Bind(service).To(implementation).InScope(scope => HttpContext.Current);
}**
**public void RegisterInstance(Type service, object instance)
{
_kernel.Bind(service).ToConstant(instance);
}**
**public void RegisterInstance(Type service, object instance, string named)
{
_kernel.Bind(service).ToConstant(instance).Named(named);
}**
}