瀏覽代碼

[publish]

lith 4 年之前
父節點
當前提交
54d51efaa0
共有 46 個文件被更改,包括 668 次插入101 次删除
  1. 12 12
      dotnet/Doc/PublishFile/SersDocker/docker制作镜像Sers/docker导入导出镜像.txt
  2. 12 12
      dotnet/Doc/PublishFile/SersDocker/docker制作镜像Sers/制作镜像Sers.txt
  3. 2 2
      dotnet/Doc/PublishFile/SersDocker/docker部署Sers/Demo/docker部署demo_station.txt
  4. 2 2
      dotnet/Doc/PublishFile/SersDocker/docker部署Sers/Robot/docker部署demo_robot.txt
  5. 2 2
      dotnet/Doc/PublishFile/SersDocker/docker部署Sers/SersAll/docker部署demo_sersall.txt
  6. 1 1
      dotnet/Gateway/App.Gateway/App.Gateway.csproj
  7. 1 1
      dotnet/Gateway/Sers.Gateway/Sers.Gateway/Sers.Gateway.csproj
  8. 1 1
      dotnet/Library/Sers/Sers.CL/Ipc/Sers.CL.Ipc.NamedPipe/Doc/Sers.CL.Ipc.NamedPipe - 额外命名管道/Sers.CL.Ipc.NamedPipe.csproj
  9. 1 1
      dotnet/Library/Sers/Sers.CL/Ipc/Sers.CL.Ipc.NamedPipe/Sers.CL.Ipc.NamedPipe.csproj
  10. 1 1
      dotnet/Library/Sers/Sers.CL/Ipc/Sers.CL.Ipc.SharedMemory/Sers.CL.Ipc.SharedMemory.csproj
  11. 1 1
      dotnet/Library/Sers/Sers.CL/Socket/Sers.CL.Socket.Iocp/Sers.CL.Socket.Iocp.csproj
  12. 1 1
      dotnet/Library/Sers/Sers.CL/Socket/Sers.CL.Socket.ThreadWait/Sers.CL.Socket.ThreadWait.csproj
  13. 1 1
      dotnet/Library/Sers/Sers.CL/WebSocket/Sers.CL.WebSocket/Sers.CL.WebSocket.csproj
  14. 1 1
      dotnet/Library/Sers/Sers.CL/Zmq/FullDuplex/Sers.CL.Zmq.FullDuplex/Sers.CL.Zmq.FullDuplex.csproj
  15. 1 1
      dotnet/Library/Sers/Sers.CL/Zmq/ThreadWait/Sers.CL.ClrZmq.ThreadWait/Sers.CL.ClrZmq.ThreadWait.csproj
  16. 1 4
      dotnet/Library/Sers/Sers.Core/Sers.Core/CL/CommunicationManage/CommunicationManageClient.cs
  17. 1 3
      dotnet/Library/Sers/Sers.Core/Sers.Core/CL/CommunicationManage/CommunicationManageServer.cs
  18. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/ApiEvent/EventBuilder.cs
  19. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/ApiLoader/ApiLoaderMng.cs
  20. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/App/AppEvent/AppEventLoader.cs
  21. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Sers.Core.csproj
  22. 2 2
      dotnet/Library/Sers/Sers.Core/Sers.Core/SersLoader/ApiLoader.cs
  23. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Util/StreamSecurity/SecurityManager.cs
  24. 1 1
      dotnet/Library/Sers/Sers.Hardware/Sers.Hardware/Sers.Hardware.csproj
  25. 1 1
      dotnet/Library/Sers/Sers.ServiceStation/Sers.ServiceStation/Sers.ServiceStation.csproj
  26. 198 0
      dotnet/Library/Vit/Vit.Core/Vit.Core/Util/Reflection/ObjectLoader.cs
  27. 4 3
      dotnet/Library/Vit/Vit.Core/Vit.Core/Vit.Core.csproj
  28. 1 1
      dotnet/Library/Vit/Vit.Net.Http.FormFile/Vit.Net.Http.FormFile.csproj
  29. 1 1
      dotnet/Library/Vit/Vit.WebHost/Vit.WebHost.csproj
  30. 1 1
      dotnet/ServiceCenter/App.Gover.Gateway/App.Gover.Gateway.csproj
  31. 18 18
      dotnet/ServiceCenter/App.ServiceCenter.NetFx/App.ServiceCenter.NetFx/App.ServiceCenter.NetFx.csproj
  32. 9 9
      dotnet/ServiceCenter/App.ServiceCenter.NetFx/App.ServiceCenter.NetFx/packages.config
  33. 1 1
      dotnet/ServiceCenter/App.ServiceCenter/App.ServiceCenter.csproj
  34. 1 1
      dotnet/ServiceCenter/Sers.ServiceCenter/Apm/Sers.Gover.Apm.Zipkin/Sers.Gover.Apm.Zipkin.csproj
  35. 1 1
      dotnet/ServiceCenter/Sers.ServiceCenter/Sers.Gover/Sers.Gover.csproj
  36. 1 1
      dotnet/ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter.csproj
  37. 1 1
      dotnet/ServiceStation/ApiLoader/Sers.NetcoreLoader/Sers.NetcoreLoader.csproj
  38. 1 1
      dotnet/ServiceStation/ApiLoader/Sers.Serslot/Sers.Serslot.csproj
  39. 1 1
      dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.Demo/Did.SersLoader.Demo.csproj
  40. 1 1
      dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.HelloWorld/Did.SersLoader.HelloWorld.csproj
  41. 1 1
      dotnet/ServiceStation/Demo/StressTest/App.Robot.Station/App.Robot.Station.csproj
  42. 1 1
      dotnet/ServiceStation/Ioc/App.Ioc.Station/App.Ioc.Station.csproj
  43. 1 1
      dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Sers.Ioc.csproj
  44. 304 0
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Entensions/IServiceCollection_Populate_Entensions.cs
  45. 65 0
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Entensions/readme.md
  46. 5 1
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Vit.Ioc.csproj

+ 12 - 12
dotnet/Doc/PublishFile/SersDocker/docker制作镜像Sers/docker导入导出镜像.txt

@@ -4,13 +4,13 @@ docker save -o /root/image/dotnet.2.1.tar sersms/dotnet:2.1
 docker save -o /root/image/cgateway.1.2.0.tar sersms/cgateway:1.2.0
 
 
-docker save -o /root/image/servicecenter.2.1.1.453.tar sersms/sers_dotnet_servicecenter:2.1.1.453
-docker save -o /root/image/gateway.2.1.1.453.tar sersms/sers_dotnet_gateway:2.1.1.453
-docker save -o /root/image/gover.2.1.1.453.tar sersms/sers_dotnet_gover:2.1.1.453
+docker save -o /root/image/servicecenter.2.1.1.461.tar sersms/sers_dotnet_servicecenter:2.1.1.461
+docker save -o /root/image/gateway.2.1.1.461.tar sersms/sers_dotnet_gateway:2.1.1.461
+docker save -o /root/image/gover.2.1.1.461.tar sersms/sers_dotnet_gover:2.1.1.461
 
-docker save -o /root/image/demo_robot.2.1.1.453.tar sersms/demo_robot:2.1.1.453
-docker save -o /root/image/demo_sersall.2.1.1.453.tar sersms/demo_sersall:2.1.1.453
-docker save -o /root/image/demo_station.2.1.1.453.tar sersms/demo_station:2.1.1.453
+docker save -o /root/image/demo_robot.2.1.1.461.tar sersms/demo_robot:2.1.1.461
+docker save -o /root/image/demo_sersall.2.1.1.461.tar sersms/demo_sersall:2.1.1.461
+docker save -o /root/image/demo_station.2.1.1.461.tar sersms/demo_station:2.1.1.461
 
 
 
@@ -19,13 +19,13 @@ docker save -o /root/image/demo_station.2.1.1.453.tar sersms/demo_station:2.1.1.
 docker load -i /root/image/dotnet.2.1.tar
 docker load -i /root/image/cgateway.1.2.0.tar
 
-docker load -i /root/image/servicecenter.2.1.1.453.tar
-docker load -i /root/image/gateway.2.1.1.453.tar
-docker load -i /root/image/gover.2.1.1.453.tar
+docker load -i /root/image/servicecenter.2.1.1.461.tar
+docker load -i /root/image/gateway.2.1.1.461.tar
+docker load -i /root/image/gover.2.1.1.461.tar
 
-docker load -i /root/image/demo_robot.2.1.1.453.tar
-docker load -i /root/image/demo_sersall.2.1.1.453.tar 
-docker load -i /root/image/demo_station.2.1.1.453.tar 
+docker load -i /root/image/demo_robot.2.1.1.461.tar
+docker load -i /root/image/demo_sersall.2.1.1.461.tar 
+docker load -i /root/image/demo_station.2.1.1.461.tar 
 
 
  

+ 12 - 12
dotnet/Doc/PublishFile/SersDocker/docker制作镜像Sers/制作镜像Sers.txt

@@ -39,45 +39,45 @@ cd /home/ec2-user/image
 #构建镜像并推送到 Docker Hub
 
 cd servicecenter 
-docker buildx build -t sersms/servicecenter:2.1.1.453  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
+docker buildx build -t sersms/servicecenter:2.1.1.461  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
 cd .. 
 
 cd gover 
-docker buildx build -t sersms/gover:2.1.1.453  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
+docker buildx build -t sersms/gover:2.1.1.461  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
 cd ..
 
 
 cd gateway 
-docker buildx build -t sersms/gateway:2.1.1.453  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
+docker buildx build -t sersms/gateway:2.1.1.461  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
 cd ..
 
 
 
 cd demo_robot 
-docker buildx build -t sersms/demo_robot:2.1.1.453  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
+docker buildx build -t sersms/demo_robot:2.1.1.461  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
 cd ..
 
 cd demo_station 
-docker buildx build -t sersms/demo_station:2.1.1.453  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
+docker buildx build -t sersms/demo_station:2.1.1.461  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
 cd ..
 
 cd demo_sersall 
-docker buildx build -t sersms/demo_sersall:2.1.1.453  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
+docker buildx build -t sersms/demo_sersall:2.1.1.461  --platform=linux/amd64,linux/arm64,linux/arm/v7 . --push
 cd ..
 
 
 
 #添加tag latest
-docker pull sersms/servicecenter:2.1.1.453
-docker tag sersms/servicecenter:2.1.1.453 sersms/servicecenter
+docker pull sersms/servicecenter:2.1.1.461
+docker tag sersms/servicecenter:2.1.1.461 sersms/servicecenter
 docker push sersms/servicecenter
 
-docker pull sersms/gover:2.1.1.453
-docker tag sersms/gover:2.1.1.453 sersms/gover
+docker pull sersms/gover:2.1.1.461
+docker tag sersms/gover:2.1.1.461 sersms/gover
 docker push sersms/gover
 
-docker pull sersms/gateway:2.1.1.453
-docker tag sersms/gateway:2.1.1.453 sersms/gateway
+docker pull sersms/gateway:2.1.1.461
+docker tag sersms/gateway:2.1.1.461 sersms/gateway
 docker push sersms/gateway
 
 

+ 2 - 2
dotnet/Doc/PublishFile/SersDocker/docker部署Sers/Demo/docker部署demo_station.txt

@@ -22,11 +22,11 @@ docker run --name=demo --restart=always -d \
 -v /etc/localtime:/etc/localtime \
 -v $PWD/appsettings.json:/root/app/Demo/appsettings.json \
 -v $PWD/Logs:/root/app/Demo/Logs \
-sersms/demo_station:2.1.1.453
+sersms/demo_station:2.1.1.461
 cd ..
 
 #精简
-docker run --name=demo --restart=always -d sersms/demo_station:2.1.1.453
+docker run --name=demo --restart=always -d sersms/demo_station:2.1.1.461
 
 
  

+ 2 - 2
dotnet/Doc/PublishFile/SersDocker/docker部署Sers/Robot/docker部署demo_robot.txt

@@ -23,12 +23,12 @@ docker run --name=robot --restart=always -d \
 -v $PWD/appsettings.json:/root/app/Robot/appsettings.json \
 -v $PWD/Logs:/root/app/Robot/Logs \
 -v $PWD/Data:/root/app/Robot/Data \
-sersms/demo_robot:2.1.1.453
+sersms/demo_robot:2.1.1.461
 cd ..
 
 
 #精简
-docker run --name=robot --restart=always --net=host -d sersms/demo_robot:2.1.1.453
+docker run --name=robot --restart=always --net=host -d sersms/demo_robot:2.1.1.461
 
  
 

+ 2 - 2
dotnet/Doc/PublishFile/SersDocker/docker部署Sers/SersAll/docker部署demo_sersall.txt

@@ -22,11 +22,11 @@ docker run --name=sersall --restart=always -d --net=host\
 -v $PWD/appsettings.json:/root/app/ServiceCenter/appsettings.json \
 -v $PWD/Logs:/root/app/ServiceCenter/Logs \
 -v $PWD/Data:/root/app/ServiceCenter/Data \
-sersms/demo_sersall:2.1.1.453
+sersms/demo_sersall:2.1.1.461
 cd ..
 
 #精简
-docker run --name=sersall --restart=always -d --net=host sersms/demo_sersall:2.1.1.453
+docker run --name=sersall --restart=always -d --net=host sersms/demo_sersall:2.1.1.461
 
 
 #(x.3)应用已经运行

+ 1 - 1
dotnet/Gateway/App.Gateway/App.Gateway.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Gateway/Sers.Gateway/Sers.Gateway/Sers.Gateway.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Ipc/Sers.CL.Ipc.NamedPipe/Doc/Sers.CL.Ipc.NamedPipe - 额外命名管道/Sers.CL.Ipc.NamedPipe.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Ipc/Sers.CL.Ipc.NamedPipe/Sers.CL.Ipc.NamedPipe.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Ipc/Sers.CL.Ipc.SharedMemory/Sers.CL.Ipc.SharedMemory.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Socket/Sers.CL.Socket.Iocp/Sers.CL.Socket.Iocp.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Socket/Sers.CL.Socket.ThreadWait/Sers.CL.Socket.ThreadWait.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/WebSocket/Sers.CL.WebSocket/Sers.CL.WebSocket.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Zmq/FullDuplex/Sers.CL.Zmq.FullDuplex/Sers.CL.Zmq.FullDuplex.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
   

+ 1 - 1
dotnet/Library/Sers/Sers.CL/Zmq/ThreadWait/Sers.CL.ClrZmq.ThreadWait/Sers.CL.ClrZmq.ThreadWait.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
   

+ 1 - 4
dotnet/Library/Sers/Sers.Core/Sers.Core/CL/CommunicationManage/CommunicationManageClient.cs

@@ -1,14 +1,11 @@
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Linq;
-using System.Reflection;
 using Newtonsoft.Json.Linq;
 using Sers.Core.CL.MessageOrganize;
-using Sers.Core.Module.Reflection;
 using Vit.Core.Module.Log;
-using Vit.Core.Util.Common;
 using Vit.Core.Util.ConfigurationManager;
+using Vit.Core.Util.Reflection;
 using Vit.Extensions;
 
 namespace Sers.Core.CL.CommunicationManage

+ 1 - 3
dotnet/Library/Sers/Sers.Core/Sers.Core/CL/CommunicationManage/CommunicationManageServer.cs

@@ -1,12 +1,10 @@
 using System;
 using System.Collections.Generic;
-using System.Reflection;
 using Newtonsoft.Json.Linq;
 using Sers.Core.CL.MessageOrganize;
-using Sers.Core.Module.Reflection;
 using Vit.Core.Module.Log;
-using Vit.Core.Util.Common;
 using Vit.Core.Util.ConfigurationManager;
+using Vit.Core.Util.Reflection;
 using Vit.Core.Util.Threading;
 using Vit.Extensions;
 

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Api/ApiEvent/EventBuilder.cs

@@ -9,7 +9,7 @@ using Sers.Core.Module.Api.ApiEvent.BeforeCallApi.Bearer;
 using Sers.Core.Module.Api.ApiEvent.BeforeCallApi.AccountInCookie;
 using Sers.Core.Module.Api.ApiEvent.ApiScope;
 using System.Collections.Generic;
-using Sers.Core.Module.Reflection;
+using Vit.Core.Util.Reflection;
 
 namespace Sers.Core.Module.Api.ApiEvent
 {

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/ApiLoader/ApiLoaderMng.cs

@@ -4,7 +4,7 @@ using Sers.Core.Module.Api.LocalApi;
 using Vit.Core.Module.Log;
 using System;
 using System.Collections.Generic;
-using Sers.Core.Module.Reflection;
+using Vit.Core.Util.Reflection;
 
 namespace Sers.Core.Module.ApiLoader
 {

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/App/AppEvent/AppEventLoader.cs

@@ -1,5 +1,5 @@
 using Newtonsoft.Json.Linq;
-using Sers.Core.Module.Reflection;
+using Vit.Core.Util.Reflection;
 using System;
 using System.Collections.Generic;
 using Vit.Core.Module.Log;

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Sers.Core.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 2 - 2
dotnet/Library/Sers/Sers.Core/Sers.Core/SersLoader/ApiLoader.cs

@@ -6,12 +6,12 @@ using Newtonsoft.Json.Linq;
 using Sers.Core.Module.Api.ApiDesc;
 using Sers.Core.Module.Api.LocalApi;
 using Sers.Core.Module.ApiLoader;
-using Sers.Core.Module.Reflection;
 using Sers.SersLoader.RpcVerify2;
 using Vit.Core.Module.Log;
 using Vit.Core.Util.ComponentModel.Api;
 using Vit.Core.Util.ComponentModel.Model;
 using Vit.Core.Util.ConfigurationManager;
+using Vit.Core.Util.Reflection;
 using Vit.Core.Util.XmlComment;
 using Vit.Extensions;
 
@@ -54,7 +54,7 @@ namespace Sers.SersLoader
             {
                 try
                 {
-                    config.assembly = ObjectLoader.LoadAssemblyByFile(config.assemblyFile);
+                    config.assembly = ObjectLoader.LoadAssemblyFromFile(config.assemblyFile);
                 }
                 catch (Exception ex)
                 {

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Util/StreamSecurity/SecurityManager.cs

@@ -1,5 +1,5 @@
 using Newtonsoft.Json.Linq;
-using Sers.Core.Module.Reflection;
+using Vit.Core.Util.Reflection;
 using Sers.Core.Util.StreamSecurity.Security;
 using System;
 using System.Linq;

+ 1 - 1
dotnet/Library/Sers/Sers.Hardware/Sers.Hardware/Sers.Hardware.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Sers/Sers.ServiceStation/Sers.ServiceStation/Sers.ServiceStation.csproj

@@ -3,7 +3,7 @@
  
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 198 - 0
dotnet/Library/Vit/Vit.Core/Vit.Core/Util/Reflection/ObjectLoader.cs

@@ -0,0 +1,198 @@
+#region << 版本注释-v3 >>
+/*
+ * ========================================================================
+ * 版本:v3
+ * 时间:2021-01-23
+ * 作者:lith
+ * 邮箱:sersms@163.com
+ * 说明: 
+ * ========================================================================
+*/
+#endregion
+
+
+using Microsoft.Extensions.DependencyModel;
+using System;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using Vit.Core.Module.Log;
+using Vit.Core.Util.Common;
+
+namespace Vit.Core.Util.Reflection
+{
+    public class ObjectLoader
+    {
+
+
+        #region (x.1)Assembly
+
+
+        #region LoadAssembly       
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="assemblyFile">如: "Vit.Core.dll"</param>
+        /// <param name="assemblyName">如: "Vit.Core"</param>
+        /// <returns></returns>
+        public static Assembly LoadAssembly(string assemblyFile = null, string assemblyName = null)
+        {
+            if (!string.IsNullOrEmpty(assemblyName))
+                return Assembly.Load(assemblyName);
+
+            if (!string.IsNullOrEmpty(assemblyFile))
+                return LoadAssemblyFromFile(assemblyFile);
+
+            return null;
+        }
+        #endregion
+
+
+        #region LoadAssemblyFromFile       
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="assemblyFile">如: "Vit.Core.dll"</param>
+        /// <returns></returns>
+        public static Assembly LoadAssemblyFromFile(string assemblyFile)
+        {
+            if (string.IsNullOrEmpty(assemblyFile))
+            {
+                return null;
+            }
+
+            Assembly assembly = null;
+
+            #region (x.1) get assembly from dll file
+            try
+            {
+                var filePath = CommonHelp.GetAbsPath(assemblyFile);
+                if (File.Exists(filePath))
+                {
+                    assembly = Assembly.LoadFrom(filePath);
+                }
+            }
+            catch (Exception ex)
+            {
+                Logger.Error(ex);
+            }
+            #endregion
+
+
+            var assemblyFileName = Path.GetFileNameWithoutExtension(assemblyFile);
+
+            #region (x.2)Get from DependencyContext               
+            if (assembly == null)
+            {
+                assembly = DependencyContext.Default.RuntimeLibraries
+                 .Where(m => m.Name == assemblyFileName)
+                 .Select(o => Assembly.Load(new AssemblyName(o.Name))).FirstOrDefault();
+            }
+            #endregion
+
+            #region (x.3)Get from ReferencedAssemblies               
+            if (assembly == null)
+            {
+                assembly = Assembly.GetEntryAssembly().GetReferencedAssemblies()
+                    .Where(m => m.Name == assemblyFileName)
+                    .Select(Assembly.Load).FirstOrDefault();
+            }
+            #endregion
+
+
+            #region (x.4)Get from CurrentDomain
+            if (assembly == null)
+            {
+                assembly = System.AppDomain.CurrentDomain.GetAssemblies().Where(asm => asm.ManifestModule.Name == assemblyFile).FirstOrDefault();
+            }
+            #endregion
+
+            return assembly;
+        }
+        #endregion
+
+        #endregion
+
+
+        #region (x.2)Class
+
+        /// <summary>
+        /// 若未指定assembly,则从当前加载的所有Assembly中查找
+        /// </summary>
+        /// <param name="assembly"></param>
+        /// <param name="className">如: "Vit.Core.Util.ConfigurationManager.JsonFile"、"Vit.Core.Util.ConfigurationManager.JsonFile,Vit.Core"</param>
+        /// <returns></returns>
+        public static Type GetType(string className, Assembly assembly = null)
+        {
+            if (assembly == null)
+            {
+                //(x.x.1)
+                {
+                    var obj = Type.GetType(className, false);
+                    if (obj != null) return obj;
+                }
+
+
+                //(x.x.2)load from CurrentDomain
+                foreach (var asm in System.AppDomain.CurrentDomain.GetAssemblies())
+                {
+                    var obj = asm?.GetType(className);
+                    if (obj != null) return obj;
+                }
+            }
+            else
+            {
+                try
+                {
+                    var obj = assembly.GetType(className);
+                    if (obj != null) return obj;
+                }
+                catch (Exception ex)
+                {
+                    Logger.Error(ex);
+                }
+            }
+            return null;
+        }
+
+
+
+
+
+
+        /// <summary>
+        /// 若未指定assembly,则从当前加载的所有Assembly中查找
+        /// </summary>
+        /// <param name="className">如: "Vit.Core.Util.ConfigurationManager.JsonFile"、"Vit.Core.Util.ConfigurationManager.JsonFile,Vit.Core"</param>
+        /// <param name="assemblyFile">如: "Vit.Core.dll"</param>
+        /// <param name="assemblyName">如: "Vit.Core"</param>
+        /// <returns></returns>
+        public static Type GetType(string className, string assemblyFile = null, string assemblyName = null)
+        {
+            Assembly assembly = LoadAssembly(assemblyFile, assemblyName);
+
+            return GetType(className, assembly);
+        }
+        #endregion
+
+
+
+        #region (x.3)CreateInstance
+
+        /// <summary>
+        /// 若未指定assembly,则从当前加载的所有Assembly中查找
+        /// </summary>
+        /// <param name="className">如: "Vit.Core.Util.ConfigurationManager.JsonFile"、"Vit.Core.Util.ConfigurationManager.JsonFile,Vit.Core"</param>
+        /// <param name="assemblyFile">如: "Vit.Core.dll"</param>
+        /// <param name="assemblyName">如: "Vit.Core"</param>
+        public static object CreateInstance(string className, string assemblyFile = null, string assemblyName = null)
+        {
+            var type = GetType(className, assemblyFile, assemblyName);
+            if (type != null) return Activator.CreateInstance(type);
+            return null;
+        }
+
+        #endregion
+
+    }
+}

+ 4 - 3
dotnet/Library/Vit/Vit.Core/Vit.Core/Vit.Core.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 
@@ -17,7 +17,8 @@
 
   <ItemGroup>
     <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
-    <PackageReference Include="System.Buffers" Version="4.5.1" />
-  </ItemGroup> 
+    <PackageReference Include="System.Buffers" Version="4.5.1" /> 
+    <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.0.0" />
+  </ItemGroup>
 
 </Project>

+ 1 - 1
dotnet/Library/Vit/Vit.Net.Http.FormFile/Vit.Net.Http.FormFile.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/Library/Vit/Vit.WebHost/Vit.WebHost.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/ServiceCenter/App.Gover.Gateway/App.Gover.Gateway.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 18 - 18
dotnet/ServiceCenter/App.ServiceCenter.NetFx/App.ServiceCenter.NetFx/App.ServiceCenter.NetFx.csproj

@@ -45,29 +45,29 @@
     <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.CL.Ipc.NamedPipe, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.CL.Ipc.NamedPipe.2.1.1.453\lib\netstandard2.0\Sers.CL.Ipc.NamedPipe.dll</HintPath>
+    <Reference Include="Sers.CL.Ipc.NamedPipe, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.CL.Ipc.NamedPipe.2.1.1.461\lib\netstandard2.0\Sers.CL.Ipc.NamedPipe.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.CL.Socket.Iocp, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.CL.Socket.Iocp.2.1.1.453\lib\netstandard2.0\Sers.CL.Socket.Iocp.dll</HintPath>
+    <Reference Include="Sers.CL.Socket.Iocp, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.CL.Socket.Iocp.2.1.1.461\lib\netstandard2.0\Sers.CL.Socket.Iocp.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.CL.Socket.ThreadWait, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.CL.Socket.ThreadWait.2.1.1.453\lib\netstandard2.0\Sers.CL.Socket.ThreadWait.dll</HintPath>
+    <Reference Include="Sers.CL.Socket.ThreadWait, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.CL.Socket.ThreadWait.2.1.1.461\lib\netstandard2.0\Sers.CL.Socket.ThreadWait.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.CL.WebSocket, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.CL.WebSocket.2.1.1.453\lib\netstandard2.0\Sers.CL.WebSocket.dll</HintPath>
+    <Reference Include="Sers.CL.WebSocket, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.CL.WebSocket.2.1.1.461\lib\netstandard2.0\Sers.CL.WebSocket.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.Core, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.Core.2.1.1.453\lib\netstandard2.0\Sers.Core.dll</HintPath>
+    <Reference Include="Sers.Core, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.Core.2.1.1.461\lib\netstandard2.0\Sers.Core.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.Gover, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.Gover.2.1.1.453\lib\netstandard2.0\Sers.Gover.dll</HintPath>
+    <Reference Include="Sers.Gover, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.Gover.2.1.1.461\lib\netstandard2.0\Sers.Gover.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.Hardware, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.Hardware.2.1.1.453\lib\netstandard2.0\Sers.Hardware.dll</HintPath>
+    <Reference Include="Sers.Hardware, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.Hardware.2.1.1.461\lib\netstandard2.0\Sers.Hardware.dll</HintPath>
     </Reference>
-    <Reference Include="Sers.ServiceCenter, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Sers.ServiceCenter.2.1.1.453\lib\netstandard2.0\Sers.ServiceCenter.dll</HintPath>
+    <Reference Include="Sers.ServiceCenter, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Sers.ServiceCenter.2.1.1.461\lib\netstandard2.0\Sers.ServiceCenter.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -80,8 +80,8 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
-    <Reference Include="Vit.Core, Version=2.1.1.453, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\Vit.Core.2.1.1.453\lib\netstandard2.0\Vit.Core.dll</HintPath>
+    <Reference Include="Vit.Core, Version=2.1.1.461, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Vit.Core.2.1.1.461\lib\netstandard2.0\Vit.Core.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>

+ 9 - 9
dotnet/ServiceCenter/App.ServiceCenter.NetFx/App.ServiceCenter.NetFx/packages.config

@@ -4,14 +4,14 @@
   <package id="Microsoft.DotNet.PlatformAbstractions" version="2.0.0" targetFramework="net461" />
   <package id="Microsoft.Extensions.DependencyModel" version="2.0.0" targetFramework="net461" />
   <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
-  <package id="Sers.CL.Ipc.NamedPipe" version="2.1.1.453" targetFramework="net461" />
-  <package id="Sers.CL.Socket.Iocp" version="2.1.1.453" targetFramework="net461" />
-  <package id="Sers.CL.Socket.ThreadWait" version="2.1.1.453" targetFramework="net461" />
-  <package id="Sers.CL.WebSocket" version="2.1.1.453" targetFramework="net461" />
-  <package id="Sers.Core" version="2.1.1.453" targetFramework="net461" />
-  <package id="Sers.Gover" version="2.1.1.453" targetFramework="net461" />
-  <package id="Sers.Hardware" version="2.1.1.453" targetFramework="net461" />
-  <package id="Sers.ServiceCenter" version="2.1.1.453" targetFramework="net461" />
+  <package id="Sers.CL.Ipc.NamedPipe" version="2.1.1.461" targetFramework="net461" />
+  <package id="Sers.CL.Socket.Iocp" version="2.1.1.461" targetFramework="net461" />
+  <package id="Sers.CL.Socket.ThreadWait" version="2.1.1.461" targetFramework="net461" />
+  <package id="Sers.CL.WebSocket" version="2.1.1.461" targetFramework="net461" />
+  <package id="Sers.Core" version="2.1.1.461" targetFramework="net461" />
+  <package id="Sers.Gover" version="2.1.1.461" targetFramework="net461" />
+  <package id="Sers.Hardware" version="2.1.1.461" targetFramework="net461" />
+  <package id="Sers.ServiceCenter" version="2.1.1.461" targetFramework="net461" />
   <package id="System.Buffers" version="4.5.1" targetFramework="net461" />
-  <package id="Vit.Core" version="2.1.1.453" targetFramework="net461" />
+  <package id="Vit.Core" version="2.1.1.461" targetFramework="net461" />
 </packages>

+ 1 - 1
dotnet/ServiceCenter/App.ServiceCenter/App.ServiceCenter.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/ServiceCenter/Sers.ServiceCenter/Apm/Sers.Gover.Apm.Zipkin/Sers.Gover.Apm.Zipkin.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
   </PropertyGroup>
 
   <PropertyGroup>

+ 1 - 1
dotnet/ServiceCenter/Sers.ServiceCenter/Sers.Gover/Sers.Gover.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
   </PropertyGroup>
 
   <PropertyGroup>

+ 1 - 1
dotnet/ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
   </PropertyGroup>
 
 

+ 1 - 1
dotnet/ServiceStation/ApiLoader/Sers.NetcoreLoader/Sers.NetcoreLoader.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/ServiceStation/ApiLoader/Sers.Serslot/Sers.Serslot.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.Demo/Did.SersLoader.Demo.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>

+ 1 - 1
dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.HelloWorld/Did.SersLoader.HelloWorld.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/ServiceStation/Demo/StressTest/App.Robot.Station/App.Robot.Station.csproj

@@ -4,7 +4,7 @@
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
     <RunPostBuildEvent>Always</RunPostBuildEvent>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/ServiceStation/Ioc/App.Ioc.Station/App.Ioc.Station.csproj

@@ -3,7 +3,7 @@
   <PropertyGroup>
     <OutputType>Exe</OutputType>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 1 - 1
dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Sers.Ioc.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 

+ 304 - 0
dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Entensions/IServiceCollection_Populate_Entensions.cs

@@ -0,0 +1,304 @@
+using Microsoft.Extensions.DependencyInjection;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Linq;
+using Vit.Core.Module.Log;
+using Vit.Core.Util.Reflection;
+
+namespace Vit.Extensions
+{
+
+    /// <summary>
+    ///   //appsettings.json demo
+    ///{"Ioc": {
+    ///    "Services": [
+    ///      {
+    ///        /* 生命周期。可为 Scoped、Singleton、Transient。默认Scoped */
+    ///        "Lifetime": "Scoped",
+    ///        "Service": "Cy.NetCore.Common.Interfaces.IService,Cy.NetCore.Common.Interfaces"
+    ///      },
+    ///      {
+    ///        /* 生命周期。可为 Scoped、Singleton、Transient。默认Scoped */
+    ///        "Lifetime": "Scoped",
+    ///        "Service": "Cy.NetCore.Common.Interfaces.IService,Cy.NetCore.Common.Interfaces",
+    ///        "Implementation": "Cy.NetCore.Common.DataBase.ServiceImpl.ServiceA,Cy.NetCore.Common.DataBase"
+    ///      },
+    ///      {
+    ///        /* 生命周期。可为 Scoped、Singleton、Transient。默认Scoped */
+    ///        "Lifetime": "Scoped",
+    ///        "Service": {
+    ///
+    ///          /* 在此Assembly文件中查找类(如 Vit.Core.dll)(assemblyFile、assemblyName 指定任一即可) */
+    ///          "assemblyFile": "Did.SersLoader.Demo.dll",
+    ///
+    ///          /* 在此Assembly中查找类(如 Vit.Core)(assemblyFile、assemblyName 指定任一即可) */
+    ///          //"assemblyName": "Did.SersLoader.Demo",
+    ///
+    ///          /* 动态加载的类名 */
+    ///          "className": "Bearer"
+    ///
+    ///        },
+    ///        "Implementation": {
+    ///
+    ///          /* 在此Assembly文件中查找类(如 Vit.Core.dll)(assemblyFile、assemblyName 指定任一即可) */
+    ///          "assemblyFile": "Did.SersLoader.Demo.dll",
+    ///
+    ///          /* 在此Assembly中查找类(如 Vit.Core)(assemblyFile、assemblyName 指定任一即可) */
+    ///          //"assemblyName": "Did.SersLoader.Demo",
+    ///
+    ///          /* 动态加载的类名 */
+    ///          "className": "Bearer",
+    ///
+    ///          "Invoke": [
+    ///            {
+    ///              "Name": "fieldName",
+    ///              "Value": "lith"
+    ///            },
+    ///            {
+    ///              "Name": "prpertyName",
+    ///              "Value": 12
+    ///            },
+    ///            {
+    ///              "Name": "methodName",
+    ///              "Params": [ 1, "12" ]
+    ///            }
+    ///          ]
+    ///        }
+    ///      }
+    ///    ]
+    ///  }
+    ///}
+    /// </summary>
+    public static partial class IServiceCollection_Populate_Entensions
+    { 
+
+        /// <summary>
+        /// 从配置文件自动注册服务
+        /// </summary>
+        /// <param name="serviceCollection"></param>
+        /// <param name="configPath">默认:Ioc.Services</param>
+        public static void Populate(this IServiceCollection serviceCollection,string configPath= "Ioc.Services") 
+        {
+            var serviceMaps = Vit.Core.Util.ConfigurationManager.ConfigurationManager.Instance.GetByPath<JObject[]>(configPath);
+
+            Populate(serviceCollection,serviceMaps);
+        }
+
+
+        /// <summary>
+        /// 从配置文件自动注册服务
+        /// </summary>
+        /// <param name="serviceCollection"></param>
+        public static void Populate(this IServiceCollection serviceCollection, JObject[] serviceMaps)
+        {      
+
+            if (serviceMaps == null) return;
+
+            foreach (var serviceMap in serviceMaps)
+            {
+                try
+                {
+                    //(x.1)
+                    //生命周期。可为 Scoped、Singleton、Transient。默认Scoped 
+                    string Lifetime = (serviceMap["Lifetime"]?.ConvertToString()) ?? "Scoped";
+
+                    //(x.2)
+                    Type Service = GetType(serviceMap["Service"], out _);
+                    if (Service == null) continue;
+
+                    //(x.3)
+                    Type Implementation = GetType(serviceMap["Implementation"], out var invoke);
+
+
+                    #region (x.4) implementationFactory                   
+                    Func<IServiceProvider, object> implementationFactory = null;
+                    if (invoke != null)
+                    {
+                        implementationFactory = (serviceProvider) =>
+                        {
+                            var constructorInfo = Implementation.GetConstructors().AsQueryable().Where(m => m.IsPublic)
+                            .OrderByDescending(m => m.GetParameters().Count()).FirstOrDefault();
+
+                            if (constructorInfo == null) return null;
+                            var args = constructorInfo.GetParameters().Select(m => serviceProvider.GetService(m.ParameterType)).ToArray();
+
+                            var obj = constructorInfo.Invoke(args);
+
+                            Invoke(Implementation, obj, invoke);
+
+                            return obj;
+
+                        //return Activator.CreateInstance(Implementation, args);
+                        //return null;
+                    };
+                    }
+                    #endregion
+
+
+                    #region (x.5)注入服务                    
+                    switch (Lifetime)
+                    {
+                        case "Singleton":
+
+                            if (Implementation == null)
+                            {
+                                serviceCollection.AddSingleton(Service);
+                                break;
+                            }
+
+                            if (invoke == null)
+                            {
+                                serviceCollection.AddSingleton(Service, Implementation);
+                                break;
+                            }
+
+                            serviceCollection.AddSingleton(Service, implementationFactory);
+                            break;
+                        case "Transient":
+                            if (Implementation == null)
+                            {
+                                serviceCollection.AddTransient(Service);
+                                break;
+                            }
+
+                            if (invoke == null)
+                            {
+                                serviceCollection.AddTransient(Service, Implementation);
+                                break;
+                            }
+
+                            serviceCollection.AddTransient(Service, implementationFactory);
+                            break;
+
+
+                        case "Scoped":
+                            if (Implementation == null)
+                            {
+                                serviceCollection.AddScoped(Service);
+                                break;
+                            }
+
+                            if (invoke == null)
+                            {
+                                serviceCollection.AddScoped(Service, Implementation);
+                                break;
+                            }
+
+                            serviceCollection.AddScoped(Service, implementationFactory);
+                            break;
+                    }
+                    #endregion
+
+                }
+                catch (Exception ex)
+                {
+                    Logger.Error(ex);
+                }
+            }
+        }
+
+
+
+        static Type GetType(JToken item,out JArray invoke) 
+        {
+            invoke = null;
+
+            if (item == null) return null;
+
+            string className;
+            string assemblyFile = null;
+            string assemblyName = null;
+
+         
+
+            if (item.TypeMatch(JTokenType.String))
+            {
+                className = item.ConvertToString();
+            }
+            else
+            {
+                className = item["className"].ConvertToString();
+                assemblyFile = item["assemblyFile"].ConvertToString();
+                assemblyName = item["assemblyName"].ConvertToString();
+
+                invoke = item["Invoke"] as JArray;
+            }
+            return ObjectLoader.GetType(className,assemblyFile, assemblyName);
+        }
+
+
+        static void Invoke(Type type, object obj, JArray invoke)
+        {
+            /*
+               "Invoke": [
+                {
+                  "Name": "fieldName",
+                  "Value": "lith"
+                },
+                {
+                 "Name": "prpertyName",
+                  "Value": 12
+                },
+                {
+                  "Name": "methodName",
+                  "Params": [1,"12"]
+                }
+              ]           
+             */
+            foreach (var json in invoke)
+            {
+                var name = json["Name"].ConvertToString();
+
+
+                //(x.1)Field
+                {
+                    var info = type.GetField(name);
+                    if (info != null)
+                    {
+                        info.SetValue(obj, json["Value"].Deserialize(info.FieldType));
+                        continue;
+                    }
+                }
+
+                //(x.2)Member
+                {
+                    var info = type.GetProperty(name);
+                    if (info != null)
+                    {
+                        info.SetValue(obj, json["Value"].Deserialize(info.PropertyType));
+                        continue;
+                    }
+                }
+
+
+                //(x.3)Method
+                {
+                    var info = type.GetMethod(name);
+                    if (info != null)
+                    {
+                        object[] args = null;
+                        var paramTypes = info.GetParameters()?.Select(m => m.ParameterType)?.ToArray();
+
+                        if (paramTypes != null && paramTypes.Length != 0)
+                        {
+                            args = new object[paramTypes.Length];
+                            var oriArg = json["Params"];
+                            if (oriArg is JArray ja)
+                            {
+                                for (var index = 0; index < paramTypes.Length; index++)
+                                {
+                                    args[index] = ja[index].Deserialize(paramTypes[index]);
+                                }
+                            }
+                        }
+                        info.Invoke(obj, args);
+                        continue;
+                    }
+                }
+
+
+            }
+        }
+
+    }
+}

+ 65 - 0
dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Entensions/readme.md

@@ -0,0 +1,65 @@
+# Ioc Populate
+
+## appsettings.json demo
+
+``` json
+//appsettings.json demo
+{"Ioc": {
+    "Services": [
+      {
+        /* 生命周期。可为 Scoped、Singleton、Transient。默认Scoped */
+        "Lifetime": "Scoped",
+        "Service": "Cy.NetCore.Common.Interfaces.IService,Cy.NetCore.Common.Interfaces"
+      },
+      {
+        /* 生命周期。可为 Scoped、Singleton、Transient。默认Scoped */
+        "Lifetime": "Scoped",
+        "Service": "Cy.NetCore.Common.Interfaces.IService,Cy.NetCore.Common.Interfaces",
+        "Implementation": "Cy.NetCore.Common.DataBase.ServiceImpl.ServiceA,Cy.NetCore.Common.DataBase"
+      },
+      {
+        /* 生命周期。可为 Scoped、Singleton、Transient。默认Scoped */
+        "Lifetime": "Scoped",
+        "Service": {
+
+          /* 在此Assembly文件中查找类(如 Vit.Core.dll)(assemblyFile、assemblyName 指定任一即可) */
+          "assemblyFile": "Did.SersLoader.Demo.dll",
+
+          /* 在此Assembly中查找类(如 Vit.Core)(assemblyFile、assemblyName 指定任一即可) */
+          //"assemblyName": "Did.SersLoader.Demo",
+
+          /* 动态加载的类名 */
+          "className": "Bearer"
+
+        },
+        "Implementation": {
+
+          /* 在此Assembly文件中查找类(如 Vit.Core.dll)(assemblyFile、assemblyName 指定任一即可) */
+          "assemblyFile": "Did.SersLoader.Demo.dll",
+
+          /* 在此Assembly中查找类(如 Vit.Core)(assemblyFile、assemblyName 指定任一即可) */
+          //"assemblyName": "Did.SersLoader.Demo",
+
+          /* 动态加载的类名 */
+          "className": "Bearer",
+
+          "Invoke": [
+            {
+              "Name": "fieldName",
+              "Value": "lith"
+            },
+            {
+              "Name": "prpertyName",
+              "Value": 12
+            },
+            {
+              "Name": "methodName",
+              "Params": [ 1, "12" ]
+            }
+          ]
+        }
+      }
+    ]
+  }
+}
+```

+ 5 - 1
dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Vit.Ioc.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.453</Version>
+    <Version>2.1.1.461</Version>
     <Description>https://github.com/sersms/Sers/tree/2.1.1/release</Description>
   </PropertyGroup>
 
@@ -15,4 +15,8 @@
     <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0" />
   </ItemGroup>
 
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\Library\Vit\Vit.Core\Vit.Core\Vit.Core.csproj" />
+  </ItemGroup>
+
 </Project>