Interface IServiceResolver
interface used by fastendpoints for resolving services from the DI container. implement this interface and register the implementation in MS DI for customizing service resolving.
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public interface IServiceResolver : IServiceResolverBase
Methods
CreateInstance(Type, IServiceProvider?)
create an instance of a given type (which may not be registered in the DI container). this method will be called repeatedly. so a cached delegate/compiled expression using something like CreateFactory(Type, Type[]) should be used for instance creation.
Declaration
object CreateInstance(Type type, IServiceProvider? serviceProvider = null)
Parameters
Type | Name | Description |
---|---|---|
Type | type | the type to create an instance of |
IServiceProvider | serviceProvider | optional service provider |
Returns
Type | Description |
---|---|
object |
CreateSingleton(Type)
create an instance of a given type (which may not be registered in the DI container) which will be used as a singleton. a utility such as CreateInstance(IServiceProvider, Type, params object[]) may be used. repeated calls with the same input type should return the same singleton instance by utilizing an internal concurrent/thread-safe cache.
Declaration
object CreateSingleton(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | the type to create an instance of |
Returns
Type | Description |
---|---|
object |