Class FactoryInjector
Inherited Members
Namespace: LemonEdge.API.Core.Reflection
Assembly: LemonEdge.API.dll
Syntax
public class FactoryInjector : IFactoryInjector, IDisposable, IAsyncDisposable
Constructors
FactoryInjector(IReferencePointerReadOnly<IServiceProvider>, ILogger<FactoryInjector>)
Creates a factory that resolves missing parameter types from the IServiceProvider
Declaration
public FactoryInjector(IReferencePointerReadOnly<IServiceProvider> serviceProvider, ILogger<FactoryInjector> logger = null)
Parameters
Type | Name | Description |
---|---|---|
IReferencePointerReadOnly<IServiceProvider> | serviceProvider | The service provider. |
ILogger<FactoryInjector> | logger |
Methods
Create(Type, params object[])
Create(Type, params object[]) where the Type parameters are inferred from the args.
Declaration
public object Create(Type returnType, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | returnType | The type being instantiated. |
object[] | args | The arguments to the factory method must uniquely satisfy a single constructor. |
Returns
Type | Description |
---|---|
object | The instantiated type. |
CreateInstance(Type, params object[])
Create(Type, params object[]) where the Type parameters are inferred from the args.
Does not use a factory, and thus can create an instance when there are multiple constructors, but only one that matches given the parameters
Declaration
public object CreateInstance(Type returnType, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | returnType | The type being instantiated. |
object[] | args | The arguments to the factory method must uniquely satisfy a single constructor. |
Returns
Type | Description |
---|---|
object | The instantiated type. |
CreateInstance<T>(params object[])
Create<T>(params object[]) where the Type parameters are inferred from the args.
Does not use a factory, and thus can create an instance when there are multiple constructors, but only one that matches given the parameters
Declaration
public T CreateInstance<T>(params object[] args) where T : class
Parameters
Type | Name | Description |
---|---|---|
object[] | args | The arguments to the factory method must uniquely satisfy a single constructor. |
Returns
Type | Description |
---|---|
T | The instantiated type. |
Type Parameters
Name | Description |
---|---|
T |
Create<T>(params object[])
Create<T>(params object[]) where the Type parameters are inferred from the args.
Declaration
public T Create<T>(params object[] args) where T : class
Parameters
Type | Name | Description |
---|---|---|
object[] | args | The arguments to the factory method must uniquely satisfy a single constructor. |
Returns
Type | Description |
---|---|
T | The instantiated type. |
Type Parameters
Name | Description |
---|---|
T |
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
DisposeAsync()
Declaration
public ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
ValueTask |
DisposeAsyncCore()
Declaration
protected virtual ValueTask DisposeAsyncCore()
Returns
Type | Description |
---|---|
ValueTask |