RegistrationExtensionsRegisterCompositeTService Method (ContainerBuilder, FuncIComponentContext, IEnumerableParameter, 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
Syntax public static IRegistrationBuilder<TService, SimpleActivatorData, SingleRegistrationStyle> RegisterComposite<TService>(
this ContainerBuilder builder,
Func<IComponentContext, IEnumerable<Parameter>, IEnumerable<TService>, TService> compositeDelegate
)
<ExtensionAttribute>
Public Shared Function RegisterComposite(Of TService) (
builder As ContainerBuilder,
compositeDelegate As Func(Of IComponentContext, IEnumerable(Of Parameter), IEnumerable(Of TService), TService)
) As IRegistrationBuilder(Of TService, SimpleActivatorData, SingleRegistrationStyle)
Parameters
- builder
- Type: AutofacContainerBuilder
Container builder. - compositeDelegate
- Type: SystemFuncIComponentContext, IEnumerableParameter, IEnumerableTService, TService
Callback to create a new instance of the composite, which takes the set of concrete implementations.
Type Parameters
- TService
- 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{Autofac.Core.Parameter},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