Ashampoo Burning Studio 8 includes the new record feature, which records tracks on CDs and .Q:
How does Autofac code providers work?
I have been following this tutorial to work with Autofac, and while most of it seems clear, the "Provider-Container Chain" section is a bit unclear.
The gist of it is that there's a TypeConfig class, in which you specify.RegisterType(..) and.RegisterContainerActivator(). Which as a consumer of this, I'm just a bit unclear on how they work at runtime.
Here's what the code looks like:
public static IServiceProvider Provider
public static IServiceProvider Container
//Register(object, IEnumerable, Factory)
My question is how are those instances found out and injected? Is there some kind of factory method for them?
Also, it's somewhat confusing that the docs call them providers when they are containers.
The classes which provide the providers (i.e. those classes that have.RegisterType or.RegisterContainerActivator method) are called "registrants". It is these registrants that actually manage all the registrations that need to be done (and which are used by Autofac's default behaviour).
If you write your own providers, all you need to do is to create a class that implements IProvide, where Type is the generic type of the type you want to register. This class will be given a container to use in order to manage the registrations.
Usually, the container is injected by the factory method. In Autofac, one does it in the constructor: