LogMachina.SimpleInjector
1.1.0
dotnet add package LogMachina.SimpleInjector --version 1.1.0
NuGet\Install-Package LogMachina.SimpleInjector -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LogMachina.SimpleInjector" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LogMachina.SimpleInjector" Version="1.1.0" />
<PackageReference Include="LogMachina.SimpleInjector" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LogMachina.SimpleInjector --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: LogMachina.SimpleInjector, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LogMachina.SimpleInjector@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LogMachina.SimpleInjector&version=1.1.0
#tool nuget:?package=LogMachina.SimpleInjector&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LogMachina.SimpleInjector
Use this package to register ILogMachina<TSource> and ILogMachinaFactory in a Simple Injector container without manually wiring each implementation.
What this package provides
AddLogMachina(this Container container, Action<ILogMachinaRegistrationBuilder<Container>> configure)- provider-specific registration through callbacks such as
x => x.WithNLog() - configurable Simple Injector lifestyle through provider extension overloads
Install
dotnet add package LogMachina.SimpleInjector
You also need a concrete LogMachina provider package, for example:
dotnet add package LogMachina.NLog
Basic registration
using LogMachina.SimpleInjector;
using SimpleInjector;
var container = new Container();
container.AddLogMachina(x => x.WithNLog());
After registration, you can resolve typed loggers and the factory:
using LogMachina;
var log = container.GetInstance<ILogMachina<OrderProcessor>>();
var factory = container.GetInstance<ILogMachinaFactory>();
Choosing a lifestyle
By default, LogMachina services are registered as singletons. You can override that:
using LogMachina.SimpleInjector;
using SimpleInjector;
var container = new Container();
container.AddLogMachina(x => x.WithNLog(Lifestyle.Transient));
Notes
- The provider assembly must be referenced by your application so it can be discovered.
AddLogMachina(...)throwsInvalidOperationExceptionif the callback completes without selecting a provider.- If more than one implementation is found for the same LogMachina service type, registration fails with an
InvalidOperationException. - This package handles container registration only. Provider-specific behavior and configuration remain the responsibility of the provider package.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- LogMachina (>= 1.1.0)
- SimpleInjector (>= 5.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Removed provider assembly scanning. Added callback-based provider selection with explicit validation.