IntegrityContainer.RegisterFactory<TServiceType>(Func<IServiceProvider, TServiceType>) Method

Registers a delegate with the specified container as an argument to resolve an instance of the specified type with a corresponding TServiceType key.

Namespace: DevExpress.Utils.IoC

Assembly: DevExpress.Data.v20.1.dll

Declaration

public FactoryRegistration RegisterFactory<TServiceType>(
    Func<IServiceProvider, TServiceType> factory
)
Public Function RegisterFactory(Of TServiceType)(
    factory As Func(Of IServiceProvider, TServiceType)
) As FactoryRegistration

Parameters

Name Type Description
factory Func<IServiceProvider, TServiceType>

A function, specifying the type to resolve.

Type Parameters

Name
TServiceType

Returns

Type Description
FactoryRegistration

A FactoryRegistration object.

Remarks

The following example illustrates how to use this method.


integrityContainer.RegisterFactory<IFoobar>(serviceProvider => 
FoobarFactory.Create(serviceProvider.Resolve(typeof(IDependency))));
See Also