MasterServer.Lib.Ioc 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package MasterServer.Lib.Ioc --version 1.0.3
                    
NuGet\Install-Package MasterServer.Lib.Ioc -Version 1.0.3
                    
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="MasterServer.Lib.Ioc" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MasterServer.Lib.Ioc" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="MasterServer.Lib.Ioc" />
                    
Project file
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 MasterServer.Lib.Ioc --version 1.0.3
                    
#r "nuget: MasterServer.Lib.Ioc, 1.0.3"
                    
#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 MasterServer.Lib.Ioc@1.0.3
                    
#: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=MasterServer.Lib.Ioc&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=MasterServer.Lib.Ioc&version=1.0.3
                    
Install as a Cake Tool

Automation.Lib.Ioc

依赖注入容器库,基于Autofac提供自动服务注册和依赖注入功能。 作者邮箱:dengjianhua1999@qq.com

特性

  • 基于Autofac的IoC容器
  • 自动从程序集扫描并注册服务
  • 支持属性注入和构造函数注入
  • 集成Microsoft.Extensions.Logging
  • 支持动态代理
  • 支持服务生命周期管理

使用方式

1. 基本使用

using Automation.Lib.Ioc;

// 注册程序集中的服务
ServiceInstaller.RegisterToIocFromAssembly("YourAssemblyName");

// 获取服务。如果使用构造函数注入就不需要这一步
var service = ServiceInstaller.Resolve<YourService>();

2. 与Microsoft DI集成

var services = new ServiceCollection();
services.AddLoggingWithNLog();

// 注册服务
ServiceInstaller.RegisterToIocFromAssembly(services, "Test");

var logger = ServiceInstaller.Resolve<ILogger<PlcService>>();
logger.Info("测试3");

3. 服务注册属性

使用ServiceAttribute标记服务:

[Service]
public class MyService
{
    // 服务实现
}

安装

通过NuGet安装:

Install-Package Automation.Lib.Ioc

依赖

  • Autofac
  • Microsoft.Extensions.DependencyInjection
  • Microsoft.Extensions.Logging</content>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 106 4/23/2026
1.0.4 120 1/19/2026
1.0.3 178 12/26/2025
1.0.2 194 12/25/2025
1.0.1 196 11/26/2025
1.0.0 191 11/26/2025