AutofacDependencyResolver class¶
Defined in
Namespace: Splat.Autofac
Assembly: Splat.Autofac.dll
Full name: Splat.Autofac.AutofacDependencyResolver
Modifiers: public
Summary¶
Provides an Autofac-based implementation of the IDependencyResolver interface for resolving services and managing
registrations within ReactiveUI applications.
Applies to
net10.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net9.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0, net8.0-ios17.5, net8.0-macos14.5, net8.0-macos14.5, net8.0-macos14.2, net8.0-macos14.2, net8.0-maccatalyst17.5, net8.0-maccatalyst17.5, net8.0-ios17.5, net8.0-tvos17.2, net8.0-tvos17.2, netstandard2.1, netstandard2.1, netstandard2.0, netstandard2.0, net471, net481, net462
Class hierarchy
classDiagram
class AutofacDependencyResolver
class IDependencyResolver {
<>
}
IDependencyResolver <|.. AutofacDependencyResolver
class IReadonlyDependencyResolver {
<>
}
IReadonlyDependencyResolver <|.. AutofacDependencyResolver
class IMutableDependencyResolver {
<>
}
IMutableDependencyResolver <|.. AutofacDependencyResolver
class IDisposable {
<>
}
IDisposable <|.. AutofacDependencyResolver
Implements: IDependencyResolver, IReadonlyDependencyResolver, IMutableDependencyResolver, IDisposable
Remarks¶
This resolver integrates Autofac's container and lifetime scope management with ReactiveUI's dependency resolution system. It is designed to support the initialization and service resolution needs of ReactiveUI, including contract-based and generic service lookups. Due to Autofac 5+ containers being immutable, registration and unregistration methods are intended for internal use during initialization and should not be used by end-users after the container is built. To override default registrations, register your services after calling InitializeReactiveUI. Thread safety is ensured for all public operations. Disposing the resolver will release Autofac container resources.
Constructors¶
| Name | Summary |
|---|---|
| .ctor | Initializes a new instance of the [AutofacDependencyResolver](# class. |
Methods¶
| Name | Summary |
|---|---|
| GetService | Gets an instance of the given serviceType. Must return null if the service is not available (must not throw). |
| GetServices | Gets all instances of the given serviceType. Must return an empty collection if the service is not available (must not return null or throw). |
| SetLifetimeScope | Sets the lifetime scope which will be used to resolve ReactiveUI services. It should be set after Autofac application-wide container is built. |
| HasRegistration | Determines whether a registration exists for the specified service type. |
| Register | Important: Because Autofac 5+ containers are immutable, this method should not be used by the... |
| RegisterConstant | Registers a constant value of the specified reference type for later retrieval or use. |
| RegisterLazySingleton | Registers a singleton service of type T that is created lazily using the specified factory function. |
| UnregisterCurrent | Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. ... |
| UnregisterAll | Because Autofac 5+ containers are immutable, UnregisterAll method is not available anymore. ... |
| ServiceRegistrationCallback | Registers a callback to be invoked when a service of the specified type is registered or becomes available. |
| Dispose |