AutofacRegistrationPopulate Method (ContainerBuilder, IEnumerableServiceDescriptor, Object) |
Namespace: Autofac.Extensions.DependencyInjection
public static void Populate( this ContainerBuilder builder, IEnumerable<ServiceDescriptor> descriptors, Object lifetimeScopeTagForSingletons )
Specifying a lifetimeScopeTagForSingletons addresses a specific case where you have an application that uses Autofac but where you need to isolate a set of services in a child scope. For example, if you have a large application that self-hosts ASP.NET Core items, you may want to isolate the ASP.NET Core registrations in a child lifetime scope so they don't show up for the rest of the application. This overload allows that. Note it is the developer's responsibility to execute this and create an AutofacServiceProvider using the child lifetime scope.