Click or drag to resize

RegistrationExtensionsRegisterCompositeTService Method (ContainerBuilder, FuncIComponentContext, IEnumerableTService, TService)

Register a delegate that should always provide the composite instance of a service type when it is resolved, regardless of what other registrations for TService are available.

Composite registrations are not included when resolving a collection of TService.

Namespace:  Autofac
Assembly:  Autofac (in Autofac.dll) Version: 6.0.0+39696a967e8826f7f1ebc8c1ff4523c9dd75abe0
public static IRegistrationBuilder<TService, SimpleActivatorData, SingleRegistrationStyle> RegisterComposite<TService>(
	this ContainerBuilder builder,
	Func<IComponentContext, IEnumerable<TService>, TService> compositeDelegate


Type: AutofacContainerBuilder
Container builder.
Type: SystemFuncIComponentContext, IEnumerableTService, TService
Callback to create a new instance of the composite, which takes the set of concrete implementations.

Type Parameters

Service type to provide a composite for.

Return Value

Type: IRegistrationBuilderTService, SimpleActivatorData, SingleRegistrationStyle

[Missing <returns> documentation for "M:Autofac.RegistrationExtensions.RegisterComposite``1(Autofac.ContainerBuilder,System.Func{Autofac.IComponentContext,System.Collections.Generic.IEnumerable{``0},``0})"]

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ContainerBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also