Autofac dependency injection container
- Upgraded reference to DD4T.Core
- Suppress warnings about obsolete methods in IComponentProvider
- Install Nuget package:
Install-Package DD4T.DI.Autofac
http://www.nuget.org/packages/DD4T.DI.Autofac - Add
DD4T.DI.Autofac
namespace to your usings; - Call the
UseDD4T
method on your AutofacAutofac.ContainerBuilder
class.
var builder = new ContainerBuilder(); //set all your custom apllication binding here. builder.UseDD4T(); builder.Build();
UseDD4T will Register all default class provided by the DD4T framework.
If you need to override the default classes: (i.e. the DefaultPublicationResovler) Register your class before the method call UseDD4T
var builder = new ContainerBuilder(); //set all your custom apllication binding here. builder.RegisterType<MyCustomPublicationResovler>().As<IPublicationResolver>().SingleInstance(); builder.UseDD4T(); builder.Build();