Click or drag to resize

RegistrationExtensionsRegisterGenericComposite Method

Register an un-parameterised generic type, e.g. Composite<> to function as a composite for an open generic service, e.g. IRepository<>. Composites will be made as they are requested, e.g. with Resolve<IRepository<int>>().

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

Namespace:  Autofac
Assembly:  Autofac (in Autofac.dll) Version: 6.0.0+39696a967e8826f7f1ebc8c1ff4523c9dd75abe0
public static IRegistrationBuilder<Object, ReflectionActivatorData, DynamicRegistrationStyle> RegisterGenericComposite(
	this ContainerBuilder builder,
	Type compositeType,
	Type serviceType


Type: AutofacContainerBuilder
Container builder.
Type: SystemType
Service type of the composite. Must accept a parameter of type IEnumerableT, IListT or an array of serviceType, which will be set to the collection of registered implementations.
Type: SystemType
Service type to provide a composite for.

Return Value

Type: IRegistrationBuilderObject, ReflectionActivatorData, DynamicRegistrationStyle

[Missing <returns> documentation for "M:Autofac.RegistrationExtensions.RegisterGenericComposite(Autofac.ContainerBuilder,System.Type,System.Type)"]

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