The Autofac adapter is included and maintained in the Autofac project. It can be downloaded with the latest AutofacContrib release.

Last edited Jun 24, 2009 at 10:44 PM by ctavares, version 4

Comments

pckujawa Jul 9, 2013 at 2:50 PM 
Since there doesn't seem to be any documentation on how to use the adapter and everything links here, here's how:

You need to install CSL, Autofac, *and* Autofac.Extras for CSL (https://nuget.org/packages/Autofac.Extras.CommonServiceLocator/3.0.1). Once you do that, you have access to the Autofac.Extras.CommonServiceLocator namespace. An example of initializing is below.

Dim builder = New ContainerBuilder()
builder.RegisterType(GetType(BlahBlahBlahMyClass))
Dim c = builder.Build()
Dim locator = New Autofac.Extras.CommonServiceLocator.AutofacServiceLocator(c)
ServiceLocator.SetLocatorProvider(Function() locator)

Hope that helps!