Click or drag to resize

RegistrationExtensionsRegisterAdapterTFrom, TTo Method (ContainerBuilder, FuncTFrom, TTo)

Adapt all components implementing service TFrom to provide TTo using the provided adapter function.

Namespace:  Autofac
Assembly:  Autofac (in Autofac.dll) Version: 6.0.0+39696a967e8826f7f1ebc8c1ff4523c9dd75abe0
public static IRegistrationBuilder<TTo, LightweightAdapterActivatorData, DynamicRegistrationStyle> RegisterAdapter<TFrom, TTo>(
	this ContainerBuilder builder,
	Func<TFrom, TTo> adapter


Type: AutofacContainerBuilder
Container builder.
Type: SystemFuncTFrom, TTo
Function adapting TFrom to service TTo.

Type Parameters

Service type to adapt from.
Service type to adapt to. Must not be the same as TFrom.

Return Value

Type: IRegistrationBuilderTTo, LightweightAdapterActivatorData, DynamicRegistrationStyle

[Missing <returns> documentation for "M:Autofac.RegistrationExtensions.RegisterAdapter``2(Autofac.ContainerBuilder,System.Func{``0,``1})"]

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