Skip to content

Convention installers

wolfbyte edited this page May 9, 2011 · 2 revisions

An installer is just a method that knows what to do with a conventional type when you find it. Installers are created with the Install<TConvention>(Action<Type>) method which can be executed either directly via a call to Configure or as a part of the SetupInstallers method on Convention Profiles.

Example

Conventions.Configure(x => {
  x.Install<Services>(t => containerBuilder.RegisterType(t).AsImplementedInterfaces());
  x.Install<ModelBinders>(t => ModelBinderSystem.Register(t));

  // ...
});

Note: You can register more than one Installer for a convention but only the last one will be run. You can register installers before or after the scanners that will be looking for the conventional types but if you scan for a convention when there is not an installer for it you will get an exception.

Clone this wiki locally