RegistrationExtensionsRegisterCompositeTComposite, TService Method (ContainerBuilder) |
Register a composite type that should always provide the instance of TService 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<TComposite, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterComposite<TComposite, TService>(
this ContainerBuilder builder
)
where TComposite : TService
<ExtensionAttribute>
Public Shared Function RegisterComposite(Of TComposite As TService, TService) (
builder As ContainerBuilder
) As IRegistrationBuilder(Of TComposite, ConcreteReflectionActivatorData, SingleRegistrationStyle)
Parameters
- builder
- Type: AutofacContainerBuilder
Container builder.
Type Parameters
- TComposite
-
Service type of the composite. Must accept a parameter
of type IEnumerableT, IListT or TService[][],
which will be set to collection of registered implementations.
- TService
- Service type to provide a composite for.
Return Value
Type:
IRegistrationBuilderTComposite,
ConcreteReflectionActivatorData,
SingleRegistrationStyle[Missing <returns> documentation for "M:Autofac.RegistrationExtensions.RegisterComposite``2(Autofac.ContainerBuilder)"]
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