Wlvyr.Common.DI.SimpleInjector
0.2.2
dotnet add package Wlvyr.Common.DI.SimpleInjector --version 0.2.2
NuGet\Install-Package Wlvyr.Common.DI.SimpleInjector -Version 0.2.2
<PackageReference Include="Wlvyr.Common.DI.SimpleInjector" Version="0.2.2" />
<PackageVersion Include="Wlvyr.Common.DI.SimpleInjector" Version="0.2.2" />
<PackageReference Include="Wlvyr.Common.DI.SimpleInjector" />
paket add Wlvyr.Common.DI.SimpleInjector --version 0.2.2
#r "nuget: Wlvyr.Common.DI.SimpleInjector, 0.2.2"
#:package Wlvyr.Common.DI.SimpleInjector@0.2.2
#addin nuget:?package=Wlvyr.Common.DI.SimpleInjector&version=0.2.2
#tool nuget:?package=Wlvyr.Common.DI.SimpleInjector&version=0.2.2
Wlvyr.Common.DI.SimpleInjector
Wlvyr.Common.DI.SimpleInjector is a helper library that simplifies common setup patterns and configurations for the SimpleInjector dependency injection container.
Usage
RegisterSingleton Extension Method
using Wlvyr.Common.Data.Configuration;
using Wlvyr.Common.DI.SimpleInjector;
var dbConfigProvider = new DatabaseConfigProviderBuilder(appSettings)
.Set...()
.Set...()
.build(); // or your own IDatabaseConfigProvider.
// Register both IDatabaseConfigProvider and DatabaseExecutorFactory
container.RegisterSingleton<IDatabaseConfigProvider>(() => dbConfigProvider);
container.RegisterSingleton<IDatabaseExecutorFactory, DatabaseExecutorFactory>();
// Can use this afterwards.
container.RegisterRepository<ISomeRepository, SomeRepository>();
container.RegisterRepository<ISomRepository2, SomeRepository2>();
SomeRepository and SomeRepository2 expect an IDatabaseExecutor as a constructor parameter. Additionally, the extension method works only for repository constructors that have a single parameter of type IDatabaseExecutor.
SimpleInjectorBootstrapFactory
using Wlvyr.Common.Configuration;
using Wlvyr.Common.Reflection;
using Wlvyr.Common.DI.SimpleInjector;
var appSettings = new AppSettings(builder.Configuration);
var assemblies = AssemblyHelper.GetAssemblies(
nameIncludes: new HashSet<string>() {
// assemblies to include
// leave empty to include all
}
);
var excludedIDiConfigFullNames = new HashSet<string>() {
// IDIConfig to exclude.
};
var diBootstrap = SimpleInjectorBootstrapFactory.CreateBootstrap(
assemblies,
appSettings,
excludedIDiConfigFullNames
);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- SimpleInjector (>= 5.5.0)
- Wlvyr.Common (>= 0.3.0)
- Wlvyr.Common.Data (>= 0.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- **0.2.2**: Bumped Wlvyr.Common dependency to 0.3.0
- **0.2.1**: Updated project metadata and documentation
- **0.2.0**: Added SimpleInjectorBootstrapFactory.CreateBootstrap to simplify bootstrap creation process.