Click or drag to resize

RegistrationExtensionsRegisterAdapterTFrom, TTo Method (ContainerBuilder, FuncIComponentContext, TFrom, 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
Syntax
public static IRegistrationBuilder<TTo, LightweightAdapterActivatorData, DynamicRegistrationStyle> RegisterAdapter<TFrom, TTo>(
	this ContainerBuilder builder,
	Func<IComponentContext, TFrom, TTo> adapter
)

Parameters

builder
Type: AutofacContainerBuilder
Container builder.
adapter
Type: SystemFuncIComponentContext, TFrom, TTo
Function adapting TFrom to service TTo, given the context.

Type Parameters

TFrom
Service type to adapt from.
TTo
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{Autofac.IComponentContext,``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