RegistrationExtensionsRegisterGeneric Method (ContainerBuilder, FuncIComponentContext, Type, IEnumerableParameter, Object) |
Register a delegate that can provide instances of an open generic registration.
Namespace:
Autofac
Assembly:
Autofac (in Autofac.dll) Version: 6.0.0+39696a967e8826f7f1ebc8c1ff4523c9dd75abe0
Syntaxpublic static IRegistrationBuilder<Object, OpenGenericDelegateActivatorData, DynamicRegistrationStyle> RegisterGeneric(
this ContainerBuilder builder,
Func<IComponentContext, Type[], IEnumerable<Parameter>, Object> factory
)
<ExtensionAttribute>
Public Shared Function RegisterGeneric (
builder As ContainerBuilder,
factory As Func(Of IComponentContext, Type(), IEnumerable(Of Parameter), Object)
) As IRegistrationBuilder(Of Object, OpenGenericDelegateActivatorData, DynamicRegistrationStyle)
Parameters
- builder
- Type: AutofacContainerBuilder
The container builder. - factory
- Type: SystemFuncIComponentContext, Type, IEnumerableParameter, Object
Delegate responsible for generating an instance of a closed generic based on the open generic type being registered. It will be called with the current IComponentContext, the array of generic type arguments expected to be in the closed generic, and any parameters passed to the resolve operation.
Return Value
Type:
IRegistrationBuilderObject,
OpenGenericDelegateActivatorData,
DynamicRegistrationStyleRegistration builder allowing the registration to be configured.
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