Skip to content

AutofacDependencyResolver class

Defined in

Namespace: Splat.Autofac Assembly: Splat.Autofac.dll Full name: Splat.Autofac.AutofacDependencyResolver Modifiers: public

Summary

View source

        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

NameSummary
.ctorInitializes a new instance of the [AutofacDependencyResolver](# class.

Methods

NameSummary
GetServiceGets an instance of the given serviceType. Must return null if the service is not available (must not throw).
GetServicesGets all instances of the given serviceType. Must return an empty collection if the service is not available (must not return null or throw).
SetLifetimeScopeSets the lifetime scope which will be used to resolve ReactiveUI services. It should be set after Autofac application-wide container is built.
HasRegistrationDetermines whether a registration exists for the specified service type.
RegisterImportant: Because Autofac 5+ containers are immutable, this method should not be used by the...
RegisterConstantRegisters a constant value of the specified reference type for later retrieval or use.
RegisterLazySingletonRegisters a singleton service of type T that is created lazily using the specified factory function.
UnregisterCurrentBecause Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. ...
UnregisterAllBecause Autofac 5+ containers are immutable, UnregisterAll method is not available anymore. ...
ServiceRegistrationCallbackRegisters a callback to be invoked when a service of the specified type is registered or becomes available.
Dispose
Inherited members