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.v25.1.dll
NuGet Package: DevExpress.Data
Declaration
public FactoryRegistration RegisterFactory<TServiceType>(
Func<IServiceProvider, TServiceType> factory
)
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