Nameless.Autofac
3.4.2
dotnet add package Nameless.Autofac --version 3.4.2
NuGet\Install-Package Nameless.Autofac -Version 3.4.2
<PackageReference Include="Nameless.Autofac" Version="3.4.2" />
<PackageVersion Include="Nameless.Autofac" Version="3.4.2" />
<PackageReference Include="Nameless.Autofac" />
paket add Nameless.Autofac --version 3.4.2
#r "nuget: Nameless.Autofac, 3.4.2"
#:package Nameless.Autofac@3.4.2
#addin nuget:?package=Nameless.Autofac&version=3.4.2
#tool nuget:?package=Nameless.Autofac&version=3.4.2
Nameless Autofac Library
This library provides a set of extensions and utilities for the Autofac dependencyty injection framework.
Content
<a name="property-resolve-middleware"></a>
Property Resolve Middleware
Register the middleware in your Autofac container to enable property injection, when constrting components. This is useful for scenarios where you want to inject properties into components that are not directly registered in the container or when injection through constructor is not available.
How to Use
var builder = new ContainerBuilder();
builder.RegisterType<ClassWithPropertyToInject>()
.ConfigurePipeline(configure => {
var propertyType = typeof(IServiceToInject);
var resolver = (MemberInfo _, IComponentContext ctx) => ctx.Resolve<IServiceToInject>();
configure.Use(new PropertyResolveMiddleware(propertyType, resolver));
});
<a name="service-provider-extensions"></a>
Service Provider Extensions
<a name="component-context-extensions"></a>
Component Context Extensions
ModuleBase: This abstract class should be used when you want to create an Autofac.Module.
Methods:
- GetImplementation<TService>: Retrieves, from support assemblies, a single implementation from the given service type.
- GetImplementation(Type serviceType): Non-generic version of GetImplementation<TService>.
- GetImplementations<TService>: Retrieves, from support assemblies, all implementations from the given service type.
- GetImplementations(Type serviceType): Non-generic version of GetImplementations<TService>.
Note: All those methods searches for implementations that are:
- Exportable types
- Non-Interface
- Non-Abstract
- Should be assignable from (or generic) the given type.
PropertyResolveMiddleware: Useful to inject properties, using a factory.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Autofac.Extensions.DependencyInjection (>= 10.0.0)
- Nameless.Core (>= 3.4.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.