zijian666.DI.Configuration
1.4.1
dotnet add package zijian666.DI.Configuration --version 1.4.1
NuGet\Install-Package zijian666.DI.Configuration -Version 1.4.1
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="zijian666.DI.Configuration" Version="1.4.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="zijian666.DI.Configuration" Version="1.4.1" />
<PackageReference Include="zijian666.DI.Configuration" />
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 zijian666.DI.Configuration --version 1.4.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: zijian666.DI.Configuration, 1.4.1"
#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 zijian666.DI.Configuration@1.4.1
#: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=zijian666.DI.Configuration&version=1.4.1
#tool nuget:?package=zijian666.DI.Configuration&version=1.4.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
依赖注入配置扩展
使用方式
- 服务配置类
class MyServiceOptions
{
[BindConfiguration(true)]
public void UseFeature1() { ... }
[BindConfiguration(true)]
public void UseFeature2(Feature2Config config) { ... }
}
class Feature2Config
{
public string Path { get; set; }
public string Mode { get; set; }
}
- 传统调用方式
services.AddMyService(options =>
{
options.UseFeature1();
options.UseFeature2(new Feature2Config { Path = "xxxx", Mode = "yyyy" });
});
- 使用配置文件方式调用 3.1. 添加配置文件
{
"MyService": {
"UseFeature1": true,
"UseFeature2": {
"Path": "xxxx",
"Mode": "yyyy"
}
}
}
3.2. 调用
var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
services.AddMyService(options =>
{
configuration.Configure("MyService", options);
// configuration.GetSection("MyService").Configure(options); // 隔离其他节点的配置
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.Extensions.Configuration.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- zijian666.DI (>= 1.4.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on zijian666.DI.Configuration:
Package | Downloads |
---|---|
zijian666.WebApiExtensions
用于快速创建简单易用的标准化WebApi项目 |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.4.1 | 172 | 8/30/2025 |
1.4.0 | 147 | 7/2/2025 |
1.3.0 | 168 | 3/13/2025 |
1.2.4-beta | 108 | 12/23/2024 |
1.2.0.3-beta | 126 | 12/19/2024 |
1.2.0.2-beta | 83 | 12/19/2024 |
1.2.0-beta | 121 | 11/27/2024 |
1.1.3-beta | 125 | 9/18/2024 |
1.1.0.15-beta | 157 | 6/24/2024 |
UPLOGS.md