lith 4 年之前
父節點
當前提交
4abc93ebee
共有 19 個文件被更改,包括 21 次插入2134 次删除
  1. 0 22
      dotnet/Doc/Publish/pack sers_lib.bat
  2. 0 56
      dotnet/Sers.sln
  3. 21 21
      dotnet/ServiceStation/ApiLoader/Sers.NetcoreLoader/Sers.NetcoreLoader.csproj
  4. 0 29
      dotnet/ServiceStation/Ioc/App.Ioc.Station/App.Ioc.Station.csproj
  5. 0 50
      dotnet/ServiceStation/Ioc/App.Ioc.Station/Controllers/DemoController.cs
  6. 0 39
      dotnet/ServiceStation/Ioc/App.Ioc.Station/Program.cs
  7. 0 15
      dotnet/ServiceStation/Ioc/App.Ioc.Station/Properties/PublishProfiles/FolderProfile.pubxml
  8. 0 51
      dotnet/ServiceStation/Ioc/App.Ioc.Station/appsettings.json
  9. 0 37
      dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Extensions/UseIocExtensions.cs
  10. 0 13
      dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Properties/PublishProfiles/FolderProfile.pubxml
  11. 0 24
      dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Sers.Ioc.csproj
  12. 0 239
      dotnet/ServiceStation/Ioc/Vit.Ioc/Test/Vit.Ioc.MsTest/IocHelpTest.cs
  13. 0 19
      dotnet/ServiceStation/Ioc/Vit.Ioc/Test/Vit.Ioc.MsTest/Vit.Ioc.MsTest.csproj
  14. 0 304
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Entensions/IServiceCollection_Populate_Entensions.cs
  15. 0 65
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Entensions/readme.md
  16. 0 651
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Ioc.cs
  17. 0 459
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/IocHelp.cs
  18. 0 13
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Properties/PublishProfiles/FolderProfile.pubxml
  19. 0 27
      dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Vit.Ioc.csproj

+ 0 - 22
dotnet/Doc/Publish/pack sers_lib.bat

@@ -162,28 +162,6 @@ cd /d ../../../
 
 ::------------------ServiceStation
 
-echo 'pack Vit.Ioc'
-cd /d ServiceStation\Ioc\Vit.Ioc\Vit.Ioc
-dotnet build --configuration Release
-dotnet pack --configuration Release --output ..\..\..\..\Doc\Publish\nuget
-@if errorlevel 1 (echo . & echo .  & echo 出错,请排查!& pause) 
-cd /d ../../../../
-
-
-
-
-echo 'pack Sers.Ioc'
-cd /d ServiceStation\Ioc\Sers.Ioc\Sers.Ioc
-dotnet build --configuration Release
-dotnet pack --configuration Release --output ..\..\..\..\Doc\Publish\nuget
-@if errorlevel 1 (echo . & echo .  & echo 出错,请排查!& pause) 
-cd /d ../../../../
-
-
-
-
-
-
 
 echo 'pack Sers.Serslot'
 cd /d ServiceStation\ApiLoader\Sers.Serslot

+ 0 - 56
dotnet/Sers.sln

@@ -35,8 +35,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.ServiceStation", "Libr
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.ServiceCenter", "ServiceCenter\Sers.ServiceCenter\Sers.ServiceCenter\Sers.ServiceCenter.csproj", "{A23FC09E-008D-42F7-9073-AAA23FFF78C7}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sers.Ioc", "Sers.Ioc", "{F6D90A49-B744-4264-A988-B3EB7C8BA15C}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Zmq", "Zmq", "{60A2862F-A007-46EE-B6FA-801F2F673A07}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThreadWait", "ThreadWait", "{99B93100-C63E-4B2C-AC80-092A02EDE10C}"
@@ -47,18 +45,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vit", "Vit", "{C845E999-2AF
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vit.Core", "Library\Vit\Vit.Core\Vit.Core\Vit.Core.csproj", "{3D93159D-0B56-44A3-8C3E-B8610FD05045}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Ioc", "ServiceStation\Ioc\Sers.Ioc\Sers.Ioc\Sers.Ioc.csproj", "{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vit.Core", "Vit.Core", "{9D48C58A-06FB-4471-BEE6-5795027F8378}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vit.Ioc", "Vit.Ioc", "{66076BFD-0EBF-479D-8231-32499EE328AC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vit.Ioc", "ServiceStation\Ioc\Vit.Ioc\Vit.Ioc\Vit.Ioc.csproj", "{198B2DF1-FFC5-41AB-B836-C54E8B07667C}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{B0C8734C-7CAC-4EA4-BF49-4ECE4876BB5D}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{25BC0652-B003-4DF5-87E5-327BE2A6FCEF}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{37633A5F-54B5-4179-8BCD-B7B422B4857C}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{8ECF169A-14B8-469F-AA72-F1125238B5D7}"
@@ -67,8 +57,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Serslot", "Serslot", "{015B
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vit.Core.MsTest", "Library\Vit\Vit.Core\Test\Vit.Core.MsTest\Vit.Core.MsTest.csproj", "{B686E6B8-1509-4768-8602-AA06711C3F9F}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vit.Ioc.MsTest", "ServiceStation\Ioc\Vit.Ioc\Test\Vit.Ioc.MsTest\Vit.Ioc.MsTest.csproj", "{6C04582F-F873-4B09-885A-D51F7602A196}"
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Gover", "ServiceCenter\Sers.ServiceCenter\Sers.Gover\Sers.Gover.csproj", "{83CC90EB-7389-4F3C-855B-BEC5FE60FAB0}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.CL.Socket.Iocp", "Library\Sers\Sers.CL\Socket\Sers.CL.Socket.Iocp\Sers.CL.Socket.Iocp.csproj", "{0D8F91B2-A507-4B3D-B562-52A7584976D5}"
@@ -131,8 +119,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Gover.Apm.Zipkin", "Se
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.CL.Ipc.NamedPipe", "Library\Sers\Sers.CL\Ipc\Sers.CL.Ipc.NamedPipe\Sers.CL.Ipc.NamedPipe.csproj", "{545F1A7C-68B6-4F1F-B165-1A0F8F3DC51D}"
 EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ioc", "Ioc", "{7F49E477-66A9-4FF6-858A-BD2F1A34003E}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Library", "Library", "{C7E2D08F-7028-445E-B689-0B4E0A1B1257}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sers.Gateway", "Sers.Gateway", "{E07D5AC5-2B0F-4916-9B10-5038C8C16B71}"
@@ -143,8 +129,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sers.Gateway", "Gateway\Ser
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.Gateway", "Gateway\App.Gateway\App.Gateway.csproj", "{0A6511C0-869E-4F00-B187-FB46234474C8}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.Ioc.Station", "ServiceStation\Ioc\App.Ioc.Station\App.Ioc.Station.csproj", "{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}"
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.Gover.Gateway", "ServiceCenter\App.Gover.Gateway\App.Gover.Gateway.csproj", "{B16C9556-0AF5-4802-84DC-56D21E867E33}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.ServiceCenter", "ServiceCenter\App.ServiceCenter\App.ServiceCenter.csproj", "{75C5993B-EF75-47D0-9FCE-9073A4BF481D}"
@@ -231,22 +215,6 @@ Global
 		{3D93159D-0B56-44A3-8C3E-B8610FD05045}.Release|Any CPU.Build.0 = Release|Any CPU
 		{3D93159D-0B56-44A3-8C3E-B8610FD05045}.Release|x86.ActiveCfg = Release|Any CPU
 		{3D93159D-0B56-44A3-8C3E-B8610FD05045}.Release|x86.Build.0 = Release|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Debug|x86.Build.0 = Debug|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Release|Any CPU.Build.0 = Release|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Release|x86.ActiveCfg = Release|Any CPU
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150}.Release|x86.Build.0 = Release|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Debug|x86.Build.0 = Debug|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Release|Any CPU.Build.0 = Release|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Release|x86.ActiveCfg = Release|Any CPU
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C}.Release|x86.Build.0 = Release|Any CPU
 		{B686E6B8-1509-4768-8602-AA06711C3F9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{B686E6B8-1509-4768-8602-AA06711C3F9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{B686E6B8-1509-4768-8602-AA06711C3F9F}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -255,14 +223,6 @@ Global
 		{B686E6B8-1509-4768-8602-AA06711C3F9F}.Release|Any CPU.Build.0 = Release|Any CPU
 		{B686E6B8-1509-4768-8602-AA06711C3F9F}.Release|x86.ActiveCfg = Release|Any CPU
 		{B686E6B8-1509-4768-8602-AA06711C3F9F}.Release|x86.Build.0 = Release|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Debug|x86.Build.0 = Debug|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Release|Any CPU.Build.0 = Release|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Release|x86.ActiveCfg = Release|Any CPU
-		{6C04582F-F873-4B09-885A-D51F7602A196}.Release|x86.Build.0 = Release|Any CPU
 		{83CC90EB-7389-4F3C-855B-BEC5FE60FAB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{83CC90EB-7389-4F3C-855B-BEC5FE60FAB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{83CC90EB-7389-4F3C-855B-BEC5FE60FAB0}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -455,14 +415,6 @@ Global
 		{0A6511C0-869E-4F00-B187-FB46234474C8}.Release|Any CPU.Build.0 = Release|Any CPU
 		{0A6511C0-869E-4F00-B187-FB46234474C8}.Release|x86.ActiveCfg = Release|Any CPU
 		{0A6511C0-869E-4F00-B187-FB46234474C8}.Release|x86.Build.0 = Release|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Debug|x86.Build.0 = Debug|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Release|Any CPU.Build.0 = Release|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Release|x86.ActiveCfg = Release|Any CPU
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6}.Release|x86.Build.0 = Release|Any CPU
 		{B16C9556-0AF5-4802-84DC-56D21E867E33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{B16C9556-0AF5-4802-84DC-56D21E867E33}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{B16C9556-0AF5-4802-84DC-56D21E867E33}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -594,23 +546,17 @@ Global
 		{6A9CAD1E-6EE3-4D16-ADE1-6A99374E2E0B} = {C3954FC1-88A0-4915-AF47-E0B75AAAA63A}
 		{4DF23DD3-8BB6-49FE-A0E1-3B808145F14A} = {87F5480C-9740-4E31-8F70-5040B0641E3D}
 		{A23FC09E-008D-42F7-9073-AAA23FFF78C7} = {97C34C06-AE79-4E1A-8D04-EB0107643302}
-		{F6D90A49-B744-4264-A988-B3EB7C8BA15C} = {7F49E477-66A9-4FF6-858A-BD2F1A34003E}
 		{60A2862F-A007-46EE-B6FA-801F2F673A07} = {43888F55-C8DF-43CA-94D5-8CED6AE66D67}
 		{99B93100-C63E-4B2C-AC80-092A02EDE10C} = {60A2862F-A007-46EE-B6FA-801F2F673A07}
 		{DA14C04D-FEEF-4A3C-A9F2-BBA25897B9A4} = {AE80CB27-0860-44E8-A59D-41D8D2F815CA}
 		{C845E999-2AF8-4593-8504-AA76BDDAFBD6} = {C7E2D08F-7028-445E-B689-0B4E0A1B1257}
 		{3D93159D-0B56-44A3-8C3E-B8610FD05045} = {9D48C58A-06FB-4471-BEE6-5795027F8378}
-		{4E3DBB4B-C54A-41D8-A905-AFA871FB9150} = {F6D90A49-B744-4264-A988-B3EB7C8BA15C}
 		{9D48C58A-06FB-4471-BEE6-5795027F8378} = {C845E999-2AF8-4593-8504-AA76BDDAFBD6}
-		{66076BFD-0EBF-479D-8231-32499EE328AC} = {7F49E477-66A9-4FF6-858A-BD2F1A34003E}
-		{198B2DF1-FFC5-41AB-B836-C54E8B07667C} = {66076BFD-0EBF-479D-8231-32499EE328AC}
 		{B0C8734C-7CAC-4EA4-BF49-4ECE4876BB5D} = {9D48C58A-06FB-4471-BEE6-5795027F8378}
-		{25BC0652-B003-4DF5-87E5-327BE2A6FCEF} = {66076BFD-0EBF-479D-8231-32499EE328AC}
 		{37633A5F-54B5-4179-8BCD-B7B422B4857C} = {C3954FC1-88A0-4915-AF47-E0B75AAAA63A}
 		{8ECF169A-14B8-469F-AA72-F1125238B5D7} = {B9DBEC9A-1220-484C-A6C3-FF10757F117A}
 		{015B5793-0478-4884-A58B-8889639FD65A} = {AE80CB27-0860-44E8-A59D-41D8D2F815CA}
 		{B686E6B8-1509-4768-8602-AA06711C3F9F} = {B0C8734C-7CAC-4EA4-BF49-4ECE4876BB5D}
-		{6C04582F-F873-4B09-885A-D51F7602A196} = {25BC0652-B003-4DF5-87E5-327BE2A6FCEF}
 		{83CC90EB-7389-4F3C-855B-BEC5FE60FAB0} = {97C34C06-AE79-4E1A-8D04-EB0107643302}
 		{0D8F91B2-A507-4B3D-B562-52A7584976D5} = {F710260F-7709-4F15-8278-6C9F2D0DA1A2}
 		{84B54BE2-F856-4A87-9A67-C5285AB555E5} = {F710260F-7709-4F15-8278-6C9F2D0DA1A2}
@@ -641,12 +587,10 @@ Global
 		{AF17FAEF-DBCC-4E5C-954D-BD4F60A016C1} = {97C34C06-AE79-4E1A-8D04-EB0107643302}
 		{DD0CB14B-D8E6-46EC-AE42-2B1215C1BBDD} = {AF17FAEF-DBCC-4E5C-954D-BD4F60A016C1}
 		{545F1A7C-68B6-4F1F-B165-1A0F8F3DC51D} = {ECEEABBB-DEA2-4CD4-99EA-3E048DB23219}
-		{7F49E477-66A9-4FF6-858A-BD2F1A34003E} = {130F5CAA-BF3F-444D-B590-57F9050588D4}
 		{E07D5AC5-2B0F-4916-9B10-5038C8C16B71} = {D06867E2-E739-4E00-827A-F604E9844CBD}
 		{A32DA747-010D-4CF4-8E14-5276D172107D} = {8ECF169A-14B8-469F-AA72-F1125238B5D7}
 		{C4E13240-C54A-43FC-9B21-6D3B386F73AF} = {E07D5AC5-2B0F-4916-9B10-5038C8C16B71}
 		{0A6511C0-869E-4F00-B187-FB46234474C8} = {D06867E2-E739-4E00-827A-F604E9844CBD}
-		{5BA4B364-9C83-42D1-80AD-63BBF9F17DC6} = {7F49E477-66A9-4FF6-858A-BD2F1A34003E}
 		{B16C9556-0AF5-4802-84DC-56D21E867E33} = {ADF8B647-D701-4460-8384-8FA8E7FAEC11}
 		{75C5993B-EF75-47D0-9FCE-9073A4BF481D} = {ADF8B647-D701-4460-8384-8FA8E7FAEC11}
 		{27E24935-3726-4863-8FF2-9A867A3C2A48} = {3E627B33-8349-446E-BAE9-884FCE3595D1}

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

@@ -1,31 +1,31 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
-  <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.602</Version>
-  </PropertyGroup>
+	<PropertyGroup>
+		<TargetFramework>netstandard2.0</TargetFramework>
+		<Version>2.1.1.602</Version>
+	</PropertyGroup>
 
-  <PropertyGroup>
-    <Authors>Lith</Authors>
-    <PackageProjectUrl>https://github.com/serset/Sers/tree/2.1.1/release</PackageProjectUrl>
-    <Description>Send email to serset@yeah.net if you have any questions.</Description>
-  </PropertyGroup>
+	<PropertyGroup>
+		<Authors>Lith</Authors>
+		<PackageProjectUrl>https://github.com/serset/Sers/tree/2.1.1/release</PackageProjectUrl>
+		<Description>Send email to serset@yeah.net if you have any questions.</Description>
+	</PropertyGroup>
 
-  <PropertyGroup>
-    <DocumentationFile>bin\Debug\netstandard2.0\Sers.NetcoreLoader.xml</DocumentationFile>
-  </PropertyGroup>
+	<PropertyGroup>
+		<DocumentationFile>bin\Debug\netstandard2.0\Sers.NetcoreLoader.xml</DocumentationFile>
+	</PropertyGroup>
 
 
-  <ItemGroup>
-    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.0" /> 
-  </ItemGroup>
-
-
-  <ItemGroup>  
-    <ProjectReference Include="..\Sers.Serslot\Sers.Serslot.csproj" />
-    <ProjectReference Include="..\..\Ioc\Sers.Ioc\Sers.Ioc\Sers.Ioc.csproj" />
-  </ItemGroup>
+	<ItemGroup>
+		<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.1.0" />
+	</ItemGroup>
 
+	<ItemGroup>
+		<PackageReference Include="Sers.Ioc" Version="2.1.1.602" />
+	</ItemGroup>
 
+	<ItemGroup>
+		<ProjectReference Include="..\Sers.Serslot\Sers.Serslot.csproj" />
+	</ItemGroup>
 
 </Project>

+ 0 - 29
dotnet/ServiceStation/Ioc/App.Ioc.Station/App.Ioc.Station.csproj

@@ -1,29 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <OutputType>Exe</OutputType>
-    <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.1.1.602</Version>
-    <Description>https://github.com/serset/Sers/tree/2.1.1/release</Description>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <DocumentationFile>bin\Debug\netcoreapp2.1\App.Ioc.Station.xml</DocumentationFile>   
-  </PropertyGroup> 
-
- 
-
-  <ItemGroup>
-    <Content Include="appsettings.json">
-      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
-    </Content>
-  </ItemGroup> 
-
- 
-
-  <ItemGroup>
-    <ProjectReference Include="..\Sers.Ioc\Sers.Ioc\Sers.Ioc.csproj" />
-    <ProjectReference Include="..\..\..\Library\Sers\Sers.ServiceStation\Sers.ServiceStation\Sers.ServiceStation.csproj" />
-  </ItemGroup>
-
-</Project>

+ 0 - 50
dotnet/ServiceStation/Ioc/App.Ioc.Station/Controllers/DemoController.cs

@@ -1,50 +0,0 @@
-using Sers.SersLoader;
-using Vit.Core.Util.Common;
-using Vit.Core.Util.ComponentModel.Api;
-using Vit.Core.Util.ComponentModel.Data;
-using Vit.Ioc;
-
-namespace App.Ioc.Station.Controllers
-{
-
-
-    public class DemoController : IApiController
-    {
-
-
-        /// <summary>
-        /// Demo1-注释
-        /// </summary>
-        /// <returns>ArgModelDesc-returns</returns>
-        [SsRoute("demo")] 
-        public ApiReturn<object> Demo1()
-        {
-
-            return new {
-                Singleton1 = IocHelp.Create<ISingleton>(),
-                Singleton2 = IocHelp.Create<ISingleton>(),
-
-                Scoped1 = IocHelp.Create<IScoped>(),
-                Scoped2 = IocHelp.Create<IScoped>(),
-
-                Transient1 = IocHelp.Create<ITransient>(),
-                Transient2 = IocHelp.Create<ITransient>(),
-            };
-        }
-
-
-        public interface ISingleton { }
-        public interface IScoped { }
-        public interface ITransient { }
-
-        public class ArgModel: IScoped, ITransient, ISingleton
-        {
-            /// <summary>
-            ///  
-            /// </summary> 
-            public string guid { get; set; } = CommonHelp.NewGuid();
-
-        }
-        
-    }
-}

+ 0 - 39
dotnet/ServiceStation/Ioc/App.Ioc.Station/Program.cs

@@ -1,39 +0,0 @@
-using Vit.Extensions;
-using Sers.ServiceStation;
-using static App.Ioc.Station.Controllers.DemoController;
-using Vit.Ioc;
-using Sers.Core.Module.Api.LocalApi.Event;
-
-namespace App.Ioc.Station
-{
-    public class Program
-    {
-        public static void Main(string[] args)
-        {
-
-            ServiceStation.Init();
-
-
-            #region ioc
-            //use ioc
-            LocalApiEventMng.Instance.UseIoc();
-
-            IocHelp.AddSingleton<ISingleton, ArgModel>();
-            IocHelp.AddScoped<IScoped, ArgModel>();
-            IocHelp.AddTransient<ITransient, ArgModel>(); 
-
-            IocHelp.Update();
-            #endregion
-
-
-
-            ServiceStation.Instance.localApiService.LoadSersApi(typeof(Program).Assembly); 
-
-            ServiceStation.Start();
-
-
-            ServiceStation.RunAwait();
-
-        }
-    }
-}

+ 0 - 15
dotnet/ServiceStation/Ioc/App.Ioc.Station/Properties/PublishProfiles/FolderProfile.pubxml

@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-https://go.microsoft.com/fwlink/?LinkID=208121. 
--->
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <PublishProtocol>FileSystem</PublishProtocol>
-    <Configuration>Release</Configuration>
-    <Platform>Any CPU</Platform>
-    <TargetFramework>netcoreapp2.1</TargetFramework>
-    <PublishDir>bin\Publish</PublishDir>
-    <SelfContained>false</SelfContained>
-    <_IsPortable>true</_IsPortable>
-  </PropertyGroup>
-</Project>

+ 0 - 51
dotnet/ServiceStation/Ioc/App.Ioc.Station/appsettings.json

@@ -1,51 +0,0 @@
-{
-  "Sers": {
-    /* 通讯层配置 */
-    "CL": {      
-      /* one conn is one channel.can be multiable */
-      "Client": [
-        {
-          // Socket.Iocp
-          /* (x.1) type - Iocp */
-          /* the class of builder in assemblyFile  */
-          "className": "Sers.CL.Socket.Iocp.OrganizeClientBuilder",
-
-          /* 通信模式。可为 "Simple"   "Timer"   "SpinWait"(默认)  */
-          //"mode": "Timer",
-
-          /* (x.2) conn config */
-          /* 服务端 host地址。例如: "127.0.0.1"、"sers.cloud" */
-          "host": "127.0.0.1",
-          /* 服务端 监听端口号。例如: 4501 */
-          "port": 4501,
-
-
-          /* 连接秘钥,用以验证连接安全性。服务端和客户端必须一致 */
-          "secretKey": "SersCL"
-        }
-      ]
-    },
-
-
-    /* LocalApiService 配置,可不指定 */
-    "LocalApiService": {
-
-      /* 后台服务的线程个数(单位个,默认0,代表不开启服务) */
-      "workThreadCount": 4,
-
-      /* 默认站点名称,可多个,可不指定 */
-      "apiStationName": [ "Tool" ]
-    },
-
-
-
-    /* ServiceStation配置,可不指定 */
-    "ServiceStation": {
-
-      /* serviceStation站点信息 */
-      "serviceStationInfo": {
-        "serviceStationName": "DataPort"
-      }
-    }
-  } 
-}

+ 0 - 37
dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Extensions/UseIocExtensions.cs

@@ -1,37 +0,0 @@
-using System;
-using Newtonsoft.Json.Linq;
-using Sers.Core.Module.Api.ApiEvent.ApiScope;
-using Sers.Core.Module.Api.LocalApi.Event;
-using Vit.Ioc;
-
-namespace Vit.Extensions
-{
-    /// <summary>
-    ///  
-    /// </summary>
-    public static class UseIocExtensions
-    {
-        static bool eventIsAdded = false;
-        public static void UseIoc(this LocalApiEventMng data)
-        {
-            if (eventIsAdded) return;
-            eventIsAdded = true;
-
-            data.AddEvent_ApiScope(new ApiScopeEvent());
-        }
-
-
-        class ApiScopeEvent : IApiScopeEvent
-        {
-            public void Init(JObject config)
-            {      
-            }
-
-            public IDisposable OnCreateScope()
-            {
-                return IocHelp.CreateScope();
-            }
-        }
-
-    }
-}

+ 0 - 13
dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Properties/PublishProfiles/FolderProfile.pubxml

@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-https://go.microsoft.com/fwlink/?LinkID=208121. 
--->
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <PublishProtocol>FileSystem</PublishProtocol>
-    <Configuration>Release</Configuration>
-    <Platform>Any CPU</Platform>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <PublishDir>bin\nuget</PublishDir>
-  </PropertyGroup>
-</Project>

+ 0 - 24
dotnet/ServiceStation/Ioc/Sers.Ioc/Sers.Ioc/Sers.Ioc.csproj

@@ -1,24 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.602</Version>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <Authors>Lith</Authors>
-    <PackageProjectUrl>https://github.com/serset/Sers/tree/2.1.1/release</PackageProjectUrl>
-    <Description>Send email to serset@yeah.net if you have any questions.</Description>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <DocumentationFile>bin\Debug\netstandard2.0\Sers.Ioc.xml</DocumentationFile>
-  </PropertyGroup>
-
-
-  <ItemGroup>
-    <ProjectReference Include="..\..\Vit.Ioc\Vit.Ioc\Vit.Ioc.csproj" />
-    <ProjectReference Include="..\..\..\..\Library\Sers\Sers.Core\Sers.Core\Sers.Core.csproj" />
-  </ItemGroup>
-
-</Project>

+ 0 - 239
dotnet/ServiceStation/Ioc/Vit.Ioc/Test/Vit.Ioc.MsTest/IocHelpTest.cs

@@ -1,239 +0,0 @@
-using System;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Vit.Ioc.MsTest
-{
-    [TestClass]
-    public class IocHelpTest
-    {
-     
-
-
-
-        #region TestSingletonAndTransient
-
-
-        [TestMethod]
-        public void TestSingletonAndTransient()
-        {            
-            //(x.1)Singleton
-            IocHelp.AddSingleton<InterfaceA, ClassA>();
-            IocHelp.Update();
-            var obj0_1 = IocHelp.Create<InterfaceA>();
-            var obj0_1_HashCode = obj0_1.GetHashCode();
-
-
-            var obj0_2 = IocHelp.Create<InterfaceA>();
-            var obj0_2_HashCode = obj0_2.GetHashCode();
-
-            Assert.AreEqual(obj0_1_HashCode, obj0_2_HashCode);
-
-
-
-            //(x.2)Transient
-            IocHelp.AddTransient<InterfaceB, ClassA>();
-            IocHelp.Update();
-
-            var obj1_1 = IocHelp.Create<InterfaceB>();
-            var obj1_1_HashCode = obj1_1.GetHashCode();
-
-
-            var obj1_2 = IocHelp.Create<InterfaceB>();
-            var obj1_2_HashCode = obj1_2.GetHashCode();
-
-            Assert.AreNotEqual(obj1_1_HashCode, obj1_2_HashCode);
-
-
-        }
-        #endregion
-
-
-
-
-        #region TestScope
-
-
-        [TestMethod]
-        public void TestScope()
-        {
-            //IocHelp.AddSingleton<InterfaceA, ClassA>();
-            IocHelp.AddTransient<InterfaceB, ClassA>();
-            //var ia1 = IocHelp.Create<InterfaceA>();
-
-           
-
-            IocHelp.AddScoped<InterfaceC, ClassA>();
-
-            IocHelp.Update();
-
-
-            var obj0_1 = IocHelp.Create<InterfaceC>();
-            var obj0_1_HashCode = obj0_1.GetHashCode();
-
-
-            var obj0_2 = IocHelp.Create<InterfaceC>();
-            var obj0_2_HashCode = obj0_2.GetHashCode();
-
-            Assert.AreEqual(obj0_1_HashCode, obj0_2_HashCode);
-
-
-
-            using (var scope1 = IocHelp.CreateScope())
-            {
-                var obj1_1 = IocHelp.Create<InterfaceC>();
-                var obj1_1_HashCode = obj1_1.GetHashCode();
-
-
-                var obj1_2 = IocHelp.Create<InterfaceC>();
-                var obj1_2_HashCode = obj1_2.GetHashCode();
-
-                Assert.AreEqual(obj1_1_HashCode, obj1_2_HashCode);
-
-
-                var objB = IocHelp.Create<InterfaceB>();
-                var objB_HashCode = objB.GetHashCode();
-
-                Assert.AreNotEqual(obj1_2_HashCode, objB_HashCode);
-
-
-                using (var scope2 = IocHelp.CreateScope())
-                {
-
-                    var obj2_1 = IocHelp.Create<InterfaceC>();
-                    var obj2_1_HashCode = obj2_1.GetHashCode();
-
-
-                    var obj2_2 = IocHelp.Create<InterfaceC>();
-                    var obj2_2_HashCode = obj2_2.GetHashCode();
-
-                    Assert.AreEqual(obj2_1_HashCode, obj2_2_HashCode);
-
-
-                    Assert.AreNotEqual(obj1_2_HashCode, obj2_1_HashCode);
-
-                }
-
-                var obj1_3 = IocHelp.Create<InterfaceC>();
-                var obj1_3_HashCode = obj1_3.GetHashCode();
-
-                Assert.AreEqual(obj1_1_HashCode, obj1_3_HashCode);
-            }
-
-            var obj0_3 = IocHelp.Create<InterfaceC>();
-            var obj0_3_HashCode = obj0_3.GetHashCode();
-
-            Assert.AreEqual(obj0_1_HashCode, obj0_3_HashCode);
-        }
-        #endregion
-
-
-        #region TestAsyncLocalTask
-
-
-        [TestMethod]
-        public void TestAsyncLocalTask()
-        {
-            IocHelp.AddScoped<InterfaceC, ClassA>();
-
-            IocHelp.Update();
-
-            TestAsyncLocalTask_Event = new AutoResetEvent(false);
-
-
-            builder.Clear();
-            // 声明一个委托实例
-            Action act = async () =>
-            {
-                await RunAsync();
-            };
-
-            using (var scope = IocHelp.CreateScope())
-            { 
-              
-                act();
-
-                TestAsyncLocalTask_Event.WaitOne();
-            }         
-
-
-            string console = builder.ToString();
-
-        }
-        static AutoResetEvent TestAsyncLocalTask_Event;
-
-        static async Task RunAsync()
-        {
-            // 输出当前线程的ID
-            builder.AppendLine($"异步等待前,当前线程ID:{Thread.CurrentThread.ManagedThreadId}");
-
-            var obj0_1 = IocHelp.Create<InterfaceC>();
-            var obj0_1_HashCode = obj0_1.GetHashCode();
-
-            // 开始执行异步方法,并等待完成
-            await Task.Delay(50);
-            // 异步等待完成后,再次输出当前线程的ID
-            builder.AppendLine($"异步等待后,当前线程ID:{Thread.CurrentThread.ManagedThreadId}");
-
-
-            var obj0_2 = IocHelp.Create<InterfaceC>();
-            var obj0_2_HashCode = obj0_2.GetHashCode();
-
-            Assert.AreEqual(obj0_1_HashCode, obj0_2_HashCode);
-
-            TestAsyncLocalTask_Event.Set();
-
-        }
-        #endregion
-
-
-        #region class for test
-        interface InterfaceA
-        {
-            void MethodA();
-        }
-
-        interface InterfaceB
-        {
-            void MethodB();
-        }
-
-        interface InterfaceC
-        {
-            void MethodC();
-        }
-
-        static StringBuilder builder = new StringBuilder();
-
-        class ClassA : IDisposable, InterfaceA, InterfaceB, InterfaceC
-        {
-
-
-            public ClassA()
-            {
-                builder.Append("[ClassA.ClassA]");
-            }
-            public void Dispose()
-            {
-                builder.Append("[ClassA.Dispose]");
-            }
-
-            public void MethodA()
-            {
-                builder.Append("[ClassA.MethodA]");
-            }
-            public void MethodB()
-            {
-                builder.Append("[ClassA.MethodB]");
-            }
-            public void MethodC()
-            {
-                builder.Append("[ClassA.MethodC]");
-            }
-        }
-        #endregion
-
-    }
-}

+ 0 - 19
dotnet/ServiceStation/Ioc/Vit.Ioc/Test/Vit.Ioc.MsTest/Vit.Ioc.MsTest.csproj

@@ -1,19 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netcoreapp2.1</TargetFramework>
-
-    <IsPackable>false</IsPackable>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
-    <PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
-    <PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="..\..\Vit.Ioc\Vit.Ioc.csproj" />
-  </ItemGroup>
-
-</Project>

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

@@ -1,304 +0,0 @@
-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: assemblyFile, assemblyName: 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;
-                    }
-                }
-
-
-            }
-        }
-
-    }
-}

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

@@ -1,65 +0,0 @@
-# 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" ]
-            }
-          ]
-        }
-      }
-    ]
-  }
-}
-```

+ 0 - 651
dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Ioc.cs

@@ -1,651 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Vit.Ioc
-{
-    public class Ioc
-    {
-
-        #region AddTransient
-        /// <summary>
-        /// Adds a transient service of the type specified in <paramref name="serviceType" /> with an
-        /// implementation of the type specified in <paramref name="implementationType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationType">The implementation type of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public void AddTransient(Type serviceType, Type implementationType)
-        {
-            rootServiceCollection.AddTransient(serviceType, implementationType);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <paramref name="serviceType" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public void AddTransient(Type serviceType, Func<IServiceProvider, object> implementationFactory)
-        {
-            rootServiceCollection.AddTransient(serviceType, implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>      
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public void AddTransient<TService, TImplementation>() where TService : class where TImplementation : class, TService
-        {
-            rootServiceCollection.AddTransient<TService, TImplementation>();
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <paramref name="serviceType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register and the implementation to use.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public void AddTransient(Type serviceType)
-        {
-            rootServiceCollection.AddTransient(serviceType);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public void AddTransient<TService>() where TService : class
-        {
-            rootServiceCollection.AddTransient<TService>();
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public void AddTransient<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
-        {
-            rootServiceCollection.AddTransient<TService>(implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> using the
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public void AddTransient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
-        {
-            rootServiceCollection.AddTransient<TService, TImplementation>(implementationFactory);
-        }
-
-
-        #endregion
-
-        #region AddScoped
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <paramref name="serviceType" /> with an
-        /// implementation of the type specified in <paramref name="implementationType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationType">The implementation type of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public void AddScoped(Type serviceType, Type implementationType)
-        {          
-            rootServiceCollection.AddScoped(serviceType, implementationType);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <paramref name="serviceType" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public void AddScoped(Type serviceType, Func<IServiceProvider, object> implementationFactory)
-        {
-            rootServiceCollection.AddScoped(serviceType, implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public void AddScoped<TService, TImplementation>() where TService : class where TImplementation : class, TService
-        {
-            rootServiceCollection.AddScoped<TService, TImplementation>();
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <paramref name="serviceType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register and the implementation to use.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public void AddScoped(Type serviceType)
-        {
-            rootServiceCollection.AddScoped(serviceType);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public void AddScoped<TService>() where TService : class
-        {
-            rootServiceCollection.AddScoped<TService>();
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public void AddScoped<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
-        {
-            rootServiceCollection.AddScoped<TService>(implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> using the
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public void AddScoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
-        {
-            rootServiceCollection.AddScoped<TService, TImplementation>(implementationFactory);
-        }
-
-
-
-
-        #endregion
-
-        #region AddSingleton
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
-        /// implementation of the type specified in <paramref name="implementationType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationType">The implementation type of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton(Type serviceType, Type implementationType)
-        {
-            rootServiceCollection.AddSingleton(serviceType, implementationType);
-        }
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton(Type serviceType, Func<IServiceProvider, object> implementationFactory)
-        {
-            rootServiceCollection.AddSingleton(serviceType, implementationFactory);
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton<TService, TImplementation>()
-            where TService : class
-            where TImplementation : class, TService
-        {
-            rootServiceCollection.AddSingleton<TService, TImplementation>();
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register and the implementation to use.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton(Type serviceType)
-        {
-            rootServiceCollection.AddSingleton(serviceType);
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton<TService>()
-            where TService : class
-        {
-            rootServiceCollection.AddSingleton<TService>();
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
-        {
-            rootServiceCollection.AddSingleton<TService>(implementationFactory);
-        }
-
-
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> using the
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
-        {
-            rootServiceCollection.AddSingleton<TService, TImplementation>(implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
-        /// instance specified in <paramref name="implementationInstance" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationInstance">The instance of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton(Type serviceType, object implementationInstance)
-        {
-            rootServiceCollection.AddSingleton(serviceType, implementationInstance);
-        }
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
-        /// instance specified in <paramref name="implementationInstance" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="implementationInstance">The instance of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public void AddSingleton<TService>(TService implementationInstance) where TService : class
-        {
-            rootServiceCollection.AddSingleton<TService>(implementationInstance);
-        }
-        #endregion
-
-
-        #region Create
-
-
-        /// <summary>
-        /// Get service of type <typeparamref name="T" /> from the <see cref="T:System.IServiceProvider" />.
-        /// </summary>
-        /// <typeparam name="T">The type of service object to get.</typeparam>
-        /// <returns>A service object of type <typeparamref name="T" /> or null if there is no such service.</returns>
-        public T Create<T>()
-        {
-            //lock (this)
-            //{                 
-                return CurServiceProvider.GetService<T>();
-            //}
-        }
-
-        /// <summary>Gets the service object of the specified type.</summary>
-        /// <param name="serviceType">An object that specifies the type of service object to get.</param>
-        /// <returns>A service object of type <paramref name="serviceType">serviceType</paramref>.  
-        ///  -or-  
-        ///  null if there is no service object of type <paramref name="serviceType">serviceType</paramref>.</returns>
-        public object Create (Type serviceType) 
-        {
-            //lock (this)
-            //{
-                return CurServiceProvider.GetService(serviceType);
-            //}
-        }
-        #endregion
-
-
-        #region AutoCreate
-
-        /// <summary>
-        /// Get service of type <typeparamref name="T" /> from the <see cref="T:System.IServiceProvider" />.
-        /// if have not yet registered Type T in Ioc,then return new T();
-        /// </summary>
-        /// <typeparam name="T">The type of service object to get.</typeparam>
-        /// <returns>A service object of type <typeparamref name="T" /> or null if there is no such service.</returns>
-        public T AutoCreate<T>()where T: class,new()
-        {
-            //lock (this)
-            //{
-                return Create<T>() ?? new T();
-            //}
-        }
-
-
-        /// <summary>
-        /// Get service of type <typeparamref name="TService" /> from the <see cref="TService:System.IServiceProvider" />.
-        /// if have not yet registered Type TService in Ioc,then return new TImplementation();
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>      
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public TService AutoCreate<TService, TImplementation>() 
-            where TService : class 
-            where TImplementation : class, TService, new()        
-        {
-            //lock (this)
-            //{
-                return Create<TService>() ?? new TImplementation();
-            //}
-        }
-        #endregion
-
-
-
-
-        #region 逻辑        
-
-
-        #region 成员变量
-
-        #region AsyncCache
-
-        #region class AsyncCache<T>      
-        /// <summary>
-        /// 多包裹一层的原因是 子异步任务结束时会还原子异步任务对AsyncLocal做的更改(即子异步任务对AsyncLocal做的更改不会保留到子异步任务结束后的父异步任务中)
-        /// 参见https://blog.csdn.net/kkfd1002/article/details/80102244
-        /// </summary>
-        class AsyncCache<T>
-        {
-
-            readonly System.Threading.AsyncLocal<CachedData> _AsyncLocal = new System.Threading.AsyncLocal<CachedData>();
-
-            class CachedData
-            {
-                public T Cache;
-            }
-            public T Value
-            {
-                get
-                {
-                    if (null == _AsyncLocal.Value)
-                        return default(T);
-                    return _AsyncLocal.Value.Cache;
-                }
-                set
-                {
-                    var asyncLocal = _AsyncLocal.Value;
-                    if (null == asyncLocal) asyncLocal = _AsyncLocal.Value = new CachedData();
-                    asyncLocal.Cache = value;
-                }
-            }
-        }
-        #endregion
-
-
-
-
-        readonly AsyncCache<ScopeCache> _AsyncCache = new AsyncCache<ScopeCache>();   
-
-        ScopeCache AsyncScopeCache
-        {
-            get
-            {
-                return _AsyncCache.Value;
-            }
-            set
-            {
-                _AsyncCache.Value = value;
-            }
-        }
-
-        #endregion
-
-
-        public IServiceCollection rootServiceCollection { get; private set; }
-  
-        private IServiceProvider _rootServiceProvider;
-
-        /// <summary>
-        /// 请勿轻易设置,当serviceProvider为空时会自动创建
-        /// </summary>
-        public IServiceProvider rootServiceProvider
-        {
-            get => (_rootServiceProvider ?? (_rootServiceProvider = rootServiceCollection.BuildServiceProvider()));
-            set => _rootServiceProvider = value;
-        }
-
-
-
-        IServiceScope CurScope => (AsyncScopeCache?.Scope);
-        IServiceProvider CurServiceProvider => (AsyncScopeCache?.ServiceProvider) ?? (rootServiceProvider);
-        #endregion
-
-
-        #region class ScopeCache
-
-
-        class ScopeCache : IDisposable
-        {
-            public IServiceProvider ServiceProvider = null;
-
-            public IServiceScope Scope = null;
-
-            Ioc ioc = null;
-            ScopeCache parent = null;
-
-            public void SetToLocal(Ioc ioc, IServiceScope Scope, IServiceProvider ServiceProvider)
-            {
-                this.ioc = ioc;
-                this.Scope = Scope;
-                this.ServiceProvider = ServiceProvider;
-                lock (ioc)
-                {
-                    parent = ioc.AsyncScopeCache;
-                    ioc.AsyncScopeCache = this;
-                }
-            }
-
-            public void Dispose()
-            {
-                lock (ioc)
-                {
-                    //need judje?
-                    if (ioc.AsyncScopeCache == this)
-                    {
-                        ioc.AsyncScopeCache = parent;
-                    }
-                    else
-                    {                        
-                        throw new Exception($"did not call IServiceScope.Dispose in order[Vit.Core.Util.Ioc,{ nameof(Ioc) }.cs,Line {GetFileLineNumber()}]");
-
-                        #region GetFileLineNumber
-                        int GetFileLineNumber()
-                        {
-                            System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, true);
-                            return st.GetFrame(0).GetFileLineNumber();
-                        }                       
-                        #endregion
-
-                    }
-                }
-            }
-        }
-        #endregion
-
-
-        public Ioc(IServiceCollection serviceCollection = null)
-        {
-            SetServiceCollection(serviceCollection);
-            AddScoped<ScopeCache>();
-        }
-
-        public void SetServiceCollection(IServiceCollection serviceCollection = null)
-        {
-            rootServiceCollection = serviceCollection ?? new ServiceCollection();
-            _rootServiceProvider = null;
-        }
- 
-
-        public IServiceScope CreateScope()
-        {
-            var scope = CurServiceProvider.CreateScope();
-            try
-            {
-                var provider = scope.ServiceProvider;
-                var scopeData = provider.GetService<ScopeCache>();
-                scopeData.SetToLocal(this, scope, provider);
-                return scope;
-            }
-            catch (Exception)
-            {
-                scope.Dispose();
-                throw;
-            }
-        }
-
-
-
-        /// <summary>
-		///  请在注入后手动调用,否则所做的注入可能无效
-		/// </summary>
-		/// <returns></returns>
-		public void Update()
-        {
-            _rootServiceProvider = null;
-        }
-        #endregion
-
-
-
-        #region GetServiceDescriptor(s)
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="serviceType"></param>
-        /// <param name="lifetime"></param>
-        /// <returns></returns>
-        public List<ServiceDescriptor> GetServiceDescriptors(Type serviceType, ServiceLifetime lifetime)
-        {
-            var list = from serviceDescriptor in rootServiceCollection
-                       where serviceDescriptor.Lifetime == lifetime && serviceDescriptor.ServiceType == serviceType
-                       select serviceDescriptor;
-            return list.ToList();
-        }
-
-
-        public ServiceDescriptor GetServiceDescriptor(Type serviceType, ServiceLifetime lifetime)
-        {
-            var list = GetServiceDescriptors(serviceType, lifetime);
-
-            return list.LastOrDefault();
-            //var lasts = list.TakeLast(1).ToList();
-            //if (1 == lasts.Count)
-            //{
-            //    return lasts[0];
-            //}
-            //return null;
-        }
-        #endregion
-
-        #region Contains
-        /// <summary>
-        /// 检测是否有过注册
-        /// </summary>
-        /// <param name="serviceType">The <see cref="T:System.Type" /> of the service.</param>
-        /// <param name="lifetime">The <see cref="T:Microsoft.Extensions.DependencyInjection.ServiceLifetime" /> of the service.</param>
-        public bool Contains(Type serviceType, ServiceLifetime lifetime)
-        {
-            return 0 < GetServiceDescriptors(serviceType, lifetime).Count;
-        }
-
-        /// <summary>
-        /// 检测是否有过注册
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="lifetime">The <see cref="T:Microsoft.Extensions.DependencyInjection.ServiceLifetime" /> of the service.</param>
-        public bool Contains<TService>(ServiceLifetime lifetime)
-        {
-            return Contains(typeof(TService), lifetime);
-        }
-        #endregion
-
-
-    }
-}

+ 0 - 459
dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/IocHelp.cs

@@ -1,459 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using System;
-
-namespace Vit.Ioc
-{
-    public static class IocHelp
-    {         
-        public static readonly Ioc Instance = new Ioc();
-
-
-        #region AddTransient
-        /// <summary>
-        /// Adds a transient service of the type specified in <paramref name="serviceType" /> with an
-        /// implementation of the type specified in <paramref name="implementationType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationType">The implementation type of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static void AddTransient(Type serviceType, Type implementationType)
-        {
-            Instance.AddTransient(serviceType, implementationType);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <paramref name="serviceType" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static void AddTransient(Type serviceType, Func<IServiceProvider, object> implementationFactory)
-        {
-            Instance.AddTransient(serviceType, implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>      
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static void AddTransient<TService, TImplementation>() where TService : class where TImplementation : class, TService
-        {
-            Instance.AddTransient<TService, TImplementation>();
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <paramref name="serviceType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register and the implementation to use.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static void AddTransient(Type serviceType)
-        {
-            Instance.AddTransient(serviceType);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static void AddTransient<TService>() where TService : class
-        {
-            Instance.AddTransient<TService>();
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static void AddTransient<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
-        {
-            Instance.AddTransient<TService>(implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a transient service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> using the
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static void AddTransient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
-        {
-            Instance.AddTransient<TService, TImplementation>(implementationFactory);
-        }
-
-
-        #endregion
-
-        #region AddScoped
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <paramref name="serviceType" /> with an
-        /// implementation of the type specified in <paramref name="implementationType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationType">The implementation type of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public static void AddScoped(Type serviceType, Type implementationType)
-        {
-            Instance.AddScoped(serviceType, implementationType);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <paramref name="serviceType" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public static void AddScoped(Type serviceType, Func<IServiceProvider, object> implementationFactory)
-        {
-            Instance.AddScoped(serviceType, implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public static void AddScoped<TService, TImplementation>() where TService : class where TImplementation : class, TService
-        {
-            Instance.AddScoped<TService, TImplementation>();
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <paramref name="serviceType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register and the implementation to use.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public static void AddScoped(Type serviceType)
-        {
-            Instance.AddScoped(serviceType);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public static void AddScoped<TService>() where TService : class
-        {
-            Instance.AddScoped<TService>();
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public static void AddScoped<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
-        {
-            Instance.AddScoped<TService>(implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a scoped service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> using the
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Scoped" />
-        public static void AddScoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
-        {
-            Instance.AddScoped<TService, TImplementation>(implementationFactory);
-        }
-
-
-
-
-        #endregion
-
-        #region AddSingleton
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
-        /// implementation of the type specified in <paramref name="implementationType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationType">The implementation type of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton(Type serviceType, Type implementationType)
-        {
-            Instance.AddSingleton(serviceType, implementationType);
-        }
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton(Type serviceType, Func<IServiceProvider, object> implementationFactory)
-        {
-            Instance.AddSingleton(serviceType, implementationFactory);
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton<TService, TImplementation>()
-            where TService : class
-            where TImplementation : class, TService
-        {
-            Instance.AddSingleton<TService, TImplementation>();
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register and the implementation to use.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton(Type serviceType)
-        {
-            Instance.AddSingleton(serviceType);
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton<TService>()
-            where TService : class
-        {
-            Instance.AddSingleton<TService>();
-        }
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with a
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
-        {
-            Instance.AddSingleton<TService>(implementationFactory);
-        }
-
-
-
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
-        /// implementation type specified in <typeparamref name="TImplementation" /> using the
-        /// factory specified in <paramref name="implementationFactory" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>
-        /// <param name="implementationFactory">The factory that creates the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
-        {
-            Instance.AddSingleton<TService, TImplementation>(implementationFactory);
-        }
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <paramref name="serviceType" /> with an
-        /// instance specified in <paramref name="implementationInstance" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="serviceType">The type of the service to register.</param>
-        /// <param name="implementationInstance">The instance of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton(Type serviceType, object implementationInstance)
-        {
-            Instance.AddSingleton(serviceType, implementationInstance);
-        }
-
-        /// <summary>
-        /// Adds a singleton service of the type specified in <typeparamref name="TService" /> with an
-        /// instance specified in <paramref name="implementationInstance" /> to the
-        /// specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
-        /// </summary>
-        /// <param name="implementationInstance">The instance of the service.</param>
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton" />
-        public static void AddSingleton<TService>(TService implementationInstance) where TService : class
-        {
-            Instance.AddSingleton<TService>(implementationInstance);
-        }
-        #endregion
-
-
-        #region Create
-
-        /// <summary>
-        /// Get service of type <typeparamref name="T" /> from the <see cref="T:System.IServiceProvider" />.
-        /// </summary>
-        /// <typeparam name="T">The type of service object to get.</typeparam>
-        /// <returns>A service object of type <typeparamref name="T" /> or null if there is no such service.</returns>
-        public static T Create<T>()
-        {
-            return Instance.Create<T>();
-        }
-
-
-        /// <summary>Gets the service object of the specified type.</summary>
-        /// <param name="serviceType">An object that specifies the type of service object to get.</param>
-        /// <returns>A service object of type <paramref name="serviceType">serviceType</paramref>.  
-        ///  -or-  
-        ///  null if there is no service object of type <paramref name="serviceType">serviceType</paramref>.</returns>
-        public static object Create(Type serviceType)
-        {
-            return Instance.Create(serviceType);
-        }
-        #endregion
-
-        #region AutoCreate
-
-        /// <summary>
-        /// Get service of type <typeparamref name="T" /> from the <see cref="T:System.IServiceProvider" />.
-        /// if have not yet registered Type T in Ioc,then return new T();
-        /// </summary>
-        /// <typeparam name="T">The type of service object to get.</typeparam>
-        /// <returns>A service object of type <typeparamref name="T" /> or null if there is no such service.</returns>
-        public static T AutoCreate<T>() where T : class, new()
-        {
-            return Instance.AutoCreate<T>();
-        }
-
-
-
-
-        /// <summary>
-        /// Get service of type <typeparamref name="TService" /> from the <see cref="TService:System.IServiceProvider" />.
-        /// if have not yet registered Type TService in Ioc,then return new TImplementation();
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <typeparam name="TImplementation">The type of the implementation to use.</typeparam>      
-        /// <returns>A reference to this instance after the operation has completed.</returns>
-        /// <seealso cref="F:Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient" />
-        public static TService AutoCreate<TService, TImplementation>()
-            where TService : class
-            where TImplementation : class, TService, new()
-        {
-            return Instance.AutoCreate<TService, TImplementation>();
-        }
-        #endregion
-
-
-        #region SetServiceCollection
-        public static void SetServiceCollection(IServiceCollection serviceCollection=null)
-        {
-            Instance.SetServiceCollection(serviceCollection);
-        }
-        #endregion
-
-
-        #region CreateScope
-        public static IServiceScope CreateScope()
-        {
-            return Instance.CreateScope();
-        }
-        #endregion
-
-        #region Update       
-        /// <summary>
-        ///  请在注入后手动调用,否则所做的注入可能无效
-        /// </summary>
-        /// <returns></returns>
-        public static void Update()
-        {
-            Instance.Update();
-        }
-        #endregion
-
-
-
-        #region Contains
-        /// <summary>
-        /// 检测是否有过注册
-        /// </summary>
-        /// <param name="serviceType">The <see cref="T:System.Type" /> of the service.</param>
-        /// <param name="lifetime">The <see cref="T:Microsoft.Extensions.DependencyInjection.ServiceLifetime" /> of the service.</param>
-        public static bool Contains(Type serviceType, ServiceLifetime lifetime)
-        {
-            return Instance.Contains(serviceType, lifetime);
-        }
-
-        /// <summary>
-        /// 检测是否有过注册
-        /// </summary>
-        /// <typeparam name="TService">The type of the service to add.</typeparam>
-        /// <param name="lifetime">The <see cref="T:Microsoft.Extensions.DependencyInjection.ServiceLifetime" /> of the service.</param>
-        public static bool Contains<TService>(ServiceLifetime lifetime)
-        {
-            return Instance.Contains<TService>(lifetime);
-        }
-        #endregion
-
-    }
-}

+ 0 - 13
dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Properties/PublishProfiles/FolderProfile.pubxml

@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-https://go.microsoft.com/fwlink/?LinkID=208121. 
--->
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <PublishProtocol>FileSystem</PublishProtocol>
-    <Configuration>Release</Configuration>
-    <Platform>Any CPU</Platform>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <PublishDir>bin\nuget</PublishDir>
-  </PropertyGroup>
-</Project>

+ 0 - 27
dotnet/ServiceStation/Ioc/Vit.Ioc/Vit.Ioc/Vit.Ioc.csproj

@@ -1,27 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <Version>2.1.1.602</Version>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <Authors>Lith</Authors>
-    <PackageProjectUrl>https://github.com/serset/Sers/tree/2.1.1/release</PackageProjectUrl>
-    <Description>Send email to serset@yeah.net if you have any questions.</Description>
-  </PropertyGroup>
-
-  <PropertyGroup>
-    <DocumentationFile>bin\Debug\netstandard2.0\Vit.Ioc.xml</DocumentationFile>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
-    <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>