lith hai 1 ano
pai
achega
d8e2ecf9c5
Modificáronse 37 ficheiros con 676 adicións e 186 borrados
  1. 1 1
      dotnet/Gateway/App.Gateway/App.Gateway.csproj
  2. 1 1
      dotnet/Library/Sers/Sers.CL/Ipc/Sers.CL.Ipc.NamedPipe/Sers.CL.Ipc.NamedPipe.csproj
  3. 1 1
      dotnet/Library/Sers/Sers.CL/Socket/Sers.CL.Socket.Iocp/Sers.CL.Socket.Iocp.csproj
  4. 1 1
      dotnet/Library/Sers/Sers.CL/Socket/Sers.CL.Socket.ThreadWait/Sers.CL.Socket.ThreadWait.csproj
  5. 1 1
      dotnet/Library/Sers/Sers.CL/WebSocket/Sers.CL.WebSocket/Sers.CL.WebSocket.csproj
  6. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core.Module.Api.ApiEvent.BeforeCallApi.JsonWebToken/Sers.Core.Module.Api.ApiEvent.BeforeCallApi.JsonWebToken.csproj
  7. 7 6
      dotnet/Library/Sers/Sers.Core/Sers.Core/CL/CommunicationManage/CommunicationManageServer.cs
  8. 4 31
      dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/RpcContext.cs
  9. 1 1
      dotnet/Library/Sers/Sers.Core/Sers.Core/Sers.Core.csproj
  10. 1 1
      dotnet/Library/Sers/Sers.Gateway/Sers.Gateway/Sers.Gateway.csproj
  11. 1 1
      dotnet/Library/Sers/Sers.Hardware/Sers.Hardware/Sers.Hardware.csproj
  12. 1 1
      dotnet/Library/Sers/Sers.Serslot/Sers.Serslot/Sers.Serslot.csproj
  13. 1 1
      dotnet/Library/Sers/Sers.ServiceStation/Sers.ServiceStation/Sers.ServiceStation.csproj
  14. 6 6
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.MsTest/Extensions/TypeExtensionsTest.cs
  15. 21 9
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.MsTest/Module/SerializationTest.cs
  16. 65 0
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCacheDisposable_Test.cs
  17. 67 0
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCacheScope_Test.cs
  18. 164 0
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCache_BaseTest.cs
  19. 66 0
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCache_Test.cs
  20. 57 0
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncLocal_Test.cs
  21. 8 6
      dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Worker/ManagedThread_Test.cs
  22. 3 3
      dotnet/Library/Vit/Vit.Core/Vit.Core/Extensions/Json/TypeExtensions.cs
  23. 1 1
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/ISerialization.cs
  24. 76 3
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Json.cs
  25. 19 14
      dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Newtonsoft.cs
  26. 72 19
      dotnet/Library/Vit/Vit.Core/Vit.Core/Util/Threading/Cache/AsyncCache.cs
  27. 0 49
      dotnet/Library/Vit/Vit.Core/Vit.Core/Util/Threading/Cache/AsyncCacheHelper.cs
  28. 1 1
      dotnet/Library/Vit/Vit.Core/Vit.Core/Vit.Core.csproj
  29. 1 1
      dotnet/Library/Vit/Vit.Net.Http.FormFile/Vit.Net.Http.FormFile.csproj
  30. 1 1
      dotnet/Library/Vit/Vit.WebHost/Vit.WebHost.csproj
  31. 1 1
      dotnet/ServiceCenter/App.Gover.Gateway/App.Gover.Gateway.csproj
  32. 1 1
      dotnet/ServiceCenter/App.ServiceCenter/App.ServiceCenter.csproj
  33. 20 19
      dotnet/ServiceCenter/Sers.ServiceCenter/Sers.Gover/Base/GoverApiCenterService.cs
  34. 1 1
      dotnet/ServiceCenter/Sers.ServiceCenter/Sers.Gover/Sers.Gover.csproj
  35. 1 1
      dotnet/ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter/Sers.ServiceCenter.csproj
  36. 1 1
      dotnet/ServiceStation/Demo/SersLoader/Did.SersLoader.Demo/Did.SersLoader.Demo.csproj
  37. 1 1
      dotnet/ServiceStation/Demo/StressTest/App.Robot.Station/App.Robot.Station.csproj

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

@@ -8,7 +8,7 @@
     <PropertyGroup>
         <OutputType>Exe</OutputType>
         <TargetFramework>net6.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
         <PackageProjectUrl>https://github.com/serset/Sers</PackageProjectUrl>
     </PropertyGroup>
 

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

+ 1 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core.Module.Api.ApiEvent.BeforeCallApi.JsonWebToken/Sers.Core.Module.Api.ApiEvent.BeforeCallApi.JsonWebToken.csproj

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

+ 7 - 6
dotnet/Library/Sers/Sers.Core/Sers.Core/CL/CommunicationManage/CommunicationManageServer.cs

@@ -18,7 +18,8 @@ namespace Sers.Core.CL.CommunicationManage
     {
 
         #region static CurConn
-        static AsyncCache<IOrganizeConnection> curConn = new AsyncCache<IOrganizeConnection>();
+        //static AsyncCache<IOrganizeConnection> curConn = new AsyncCache<IOrganizeConnection>();
+        static System.Threading.AsyncLocal<IOrganizeConnection> curConn = new System.Threading.AsyncLocal<IOrganizeConnection>();
 
         /// <summary>
         /// 当前连接
@@ -62,7 +63,7 @@ namespace Sers.Core.CL.CommunicationManage
 
 
         #endregion
-        
+
 
         #region Start       
 
@@ -132,7 +133,7 @@ namespace Sers.Core.CL.CommunicationManage
             {
                 List<IOrganizeServer> organizeList = new List<IOrganizeServer>();
 
-   
+
                 #region (x.1) get configs
                 var configs = Appsettings.json.GetByPath<JObject[]>("Sers.CL.Server");
                 if (configs == null) return null;
@@ -147,7 +148,7 @@ namespace Sers.Core.CL.CommunicationManage
                     }
                 }
                 #endregion
-                 
+
 
                 //(x.2) BeforeBuildOrganize
                 try
@@ -197,8 +198,8 @@ namespace Sers.Core.CL.CommunicationManage
         #region Stop       
         public void Stop()
         {
-            if (organizeList == null) return;       
- 
+            if (organizeList == null) return;
+
             foreach (var organize in organizeList)
             {
                 try

+ 4 - 31
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/RpcContext.cs

@@ -1,17 +1,16 @@
 using System;
+
 using Sers.Core.Module.Message;
+
 using Vit.Core.Util.Threading.Cache;
 
 namespace Sers.Core.Module.Rpc
 {
-    public class RpcContext : IDisposable
+    public class RpcContext : AsyncCacheScope<RpcContext>
     {
 
         #region static
-
-        static AsyncCache<RpcContext> CurrentRpcContext_AsyncCache = new AsyncCache<RpcContext>();
-
-        public static RpcContext Current => CurrentRpcContext_AsyncCache.Value;
+        public static RpcContext Current => Instance;
 
         public static RpcContextData RpcData => Current?.rpcData;
 
@@ -24,31 +23,5 @@ namespace Sers.Core.Module.Rpc
 
         public RpcContextData rpcData;
 
-
-
-        #region 构造函数 和 Dispose
-
-        [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
-        public RpcContext()
-        {
-            //lock (CurrentRpcContext_AsyncCache)
-            //{
-            CurrentRpcContext_AsyncCache.Value = this;
-            //}
-        }
-
-        [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
-        public virtual void Dispose()
-        {
-            //lock (CurrentRpcContext_AsyncCache)
-            //{
-            if (CurrentRpcContext_AsyncCache.Value == this)
-            {
-                CurrentRpcContext_AsyncCache.Value = null;
-            }
-            //}
-        }
-        #endregion
-
     }
 }

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

@@ -7,7 +7,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

+ 6 - 6
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.MsTest/Extensions/TypeExtensionsTest.cs

@@ -12,7 +12,7 @@ namespace Vit.Core.MsTest.Extensions
     {
         [TestMethod]
         public void GetUnderlyingTypeIfNullable_Test()
-        {   
+        {
 
             Assert.AreEqual(typeof(int?).GetUnderlyingTypeIfNullable(), typeof(int));
 
@@ -29,16 +29,16 @@ namespace Vit.Core.MsTest.Extensions
         [TestMethod]
         public void Convert_Test()
         {
-           
+
             #region (x.1)string
-            
+
             int int1 = "5".Convert<int>();
             Assert.AreEqual(int1, 5);
 
             int int2 = (int)("5.1".Convert<float>());
             Assert.AreEqual(int2, 5);
 
-            int int3 =  "5.1".Convert<float>().Convert<int>();
+            int int3 = "5.1".Convert<float>().Convert<int>();
             Assert.AreEqual(int3, 5);
 
             try
@@ -47,10 +47,10 @@ namespace Vit.Core.MsTest.Extensions
                 //将会抛异常           
                 "5.1".Convert<int?>();
 
-                "5.1".Convert<int>();             
+                "5.1".Convert<int>();
             }
             catch (Exception ex)
-            {                
+            {
             }
 
 

+ 21 - 9
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.MsTest/Module/SerializationTest.cs

@@ -1,4 +1,5 @@
 using System;
+using System.Reflection;
 
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 
@@ -17,16 +18,16 @@ namespace Vit.Core.MsTest.Module
         {
             public int? id;
             public string name;
-            public DateTime time;         
+            public DateTime time;
         }
-        
+
 
         [TestMethod]
         public void TestMethod()
         {
-            string testString = "testString中文12—=¥$《》<> \n\r\t😀"+ DateTime.Now;
+            string testString = "testString中文12—=¥$《》<> \n\r\t😀" + DateTime.Now;
 
-            var modelA = new ModelA { id=1,name = testString, time=DateTime.Now };
+            var modelA = new ModelA { id = 1, name = testString, time = DateTime.Now };
 
             #region (x.1)bytes <--> String      
             Assert.AreEqual(testString.StringToBytes().BytesToString(), testString);
@@ -43,25 +44,26 @@ namespace Vit.Core.MsTest.Module
             Assert.AreEqual(Json.DeserializeFromBytes<ModelA>(Json.SerializeToBytes(modelA))?.name, testString);
             Assert.AreEqual(modelA.SerializeToBytes().DeserializeFromBytes<ModelA>()?.name, testString);
             #endregion
- 
+
 
             #region (x.5)ConvertBySerialize
             var obj_ori = new { id = 1, name = testString, time = DateTime.Now };
- 
+
             Assert.AreEqual(obj_ori.ConvertBySerialize<ModelA>()?.name, testString);
             #endregion
 
 
             #region (x.6)DateTimeFormat           
 
-            var obj = new {
+            var obj = new
+            {
                 Date = DateTime.Parse("2019-01-01 01:01:01"),
-                obj =new { Date2 = DateTime.Parse("2019-02-02 01:01:01") }
+                obj = new { Date2 = DateTime.Parse("2019-02-02 01:01:01") }
             };
 
             string str = obj.Serialize();
 
-            Serialization_Newtonsoft.Instance.serializeSetting.DateFormatString="yyyy-MM-dd";
+            Serialization_Newtonsoft.Instance.serializeSetting.DateFormatString = "yyyy-MM-dd";
 
             string str2 = obj.Serialize();
             var jtObj = str2.Deserialize<JObject>();
@@ -76,5 +78,15 @@ namespace Vit.Core.MsTest.Module
         }
 
 
+
+        [TestMethod]
+        public void TestMethod_DateTime()
+        {
+            var time = DateTime.Now;
+            var str = Json.SerializeToString(time);
+            Assert.AreEqual(time.ToString("yyyy-MM-dd HH:mm:ss"), str);
+        }
+
+
     }
 }

+ 65 - 0
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCacheDisposable_Test.cs

@@ -0,0 +1,65 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+using Vit.Core.Util.Threading.Cache;
+
+namespace Vit.Core.Util.Threading.MsTest.Cache
+{
+    [TestClass]
+    public class AsyncCacheDisposable_Test : AsyncCache_BaseTest
+    {
+
+        AsyncCache<string> asyncCache = new AsyncCache<string>();
+
+        public override void RunTest(string name)
+        {
+            using var scope = asyncCache.NewScope();
+
+            //set
+            asyncCache.Value = name;
+
+            Thread.Sleep(10);
+
+            //get
+            var actual = asyncCache.Value;
+            Assert.AreEqual(name, actual);
+        }
+
+        public override async Task RunTestAsync(string name)
+        {
+            using var scope = asyncCache.NewScope();
+
+            //set
+            await Set(name);
+
+            await Task.Delay(8);
+
+            //get
+            var actual = await Get();
+
+            Assert.AreEqual(name, actual);
+        }
+
+        async Task Set(string name)
+        {
+            asyncCache.Value = name;
+            await Task.Delay(1);
+        }
+
+        async Task<string> Get()
+        {
+            var name = asyncCache.Value;
+            await Task.Delay(1);
+            return name;
+        }
+
+
+    }
+
+     
+}

+ 67 - 0
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCacheScope_Test.cs

@@ -0,0 +1,67 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+using Vit.Core.Util.Threading.Cache;
+
+namespace Vit.Core.Util.Threading.MsTest.Cache
+{
+    [TestClass]
+    public class AsyncCacheScope_Test : AsyncCache_BaseTest
+    {
+        class CacheScope : AsyncCacheScope<CacheScope>
+        {
+            public string name;
+        }
+
+        public override void RunTest(string name)
+        {
+            using var scope = new CacheScope();
+
+            //set
+            CacheScope.Instance.name = name;
+
+            Thread.Sleep(10);
+
+            //get
+            var actual = CacheScope.Instance.name;
+            Assert.AreEqual(name, actual);
+        }
+
+        public override async Task RunTestAsync(string name)
+        {
+            using var scope = new CacheScope();
+
+            //set
+            await Set(name);
+
+            await Task.Delay(8);
+
+            //get
+            var actual = await Get();
+
+            Assert.AreEqual(name, actual);
+        }
+
+        async Task Set(string name)
+        {
+            CacheScope.Instance.name = name;
+            await Task.Delay(1);
+        }
+
+        async Task<string> Get()
+        {
+            var name = CacheScope.Instance.name;
+            await Task.Delay(1);
+            return name;
+        }
+
+
+    }
+
+     
+}

+ 164 - 0
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCache_BaseTest.cs

@@ -0,0 +1,164 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+using Vit.Core.Util.Threading.Cache;
+
+namespace Vit.Core.Util.Threading.MsTest.Cache
+{
+
+    public abstract class AsyncCache_BaseTest
+    {
+        public abstract void RunTest(string name);
+        public abstract Task RunTestAsync(string name);
+
+        #region Task
+        [TestMethod]
+        public void Test_Task()
+        {
+            int threadCount = 0;
+            int testCount = 0;
+
+            var tasks = Enumerable.Range(0, 10).Select(number => Task.Run(() =>
+                {
+                    Interlocked.Increment(ref threadCount);
+                    for (var i = 0; i < 100; i++)
+                    {
+                        Interlocked.Increment(ref testCount);
+                        var name = $"{number}_{i}_{System.Guid.NewGuid()}";
+                        RunTest(name);
+                    }
+                })
+            ).ToArray();
+
+            Task.WaitAll(tasks);
+        }
+
+        [TestMethod]
+        public void Test_TaskAsync()
+        {
+            int threadCount = 0;
+            int testCount = 0;
+
+            var tasks = Enumerable.Range(0, 10).Select(number => Task.Run(async () =>
+                {
+                    Interlocked.Increment(ref threadCount);
+                    for (var i = 0; i < 100; i++)
+                    {
+                        Interlocked.Increment(ref testCount);
+                        var name = $"{number}_{i}_{System.Guid.NewGuid()}";
+                        await RunTestAsync(name);
+                    }
+                })
+            ).ToArray();
+
+            Task.WaitAll(tasks);
+        }
+        #endregion
+
+
+
+        #region Thread
+        [TestMethod]
+        public void Test_Thread()
+        {
+            int threadCount = 0;
+            int testCount = 0;
+
+            Thread_ForEach(Enumerable.Range(0, 100), number =>
+            {
+                Interlocked.Increment(ref threadCount);
+                for (var i = 0; i < 100; i++)
+                {
+                    Interlocked.Increment(ref testCount);
+                    var name = $"{number}_{i}_{System.Guid.NewGuid()}";
+                    RunTest(name);
+                }
+            });
+        }
+
+        [TestMethod]
+        public void Test_ThreadAsync()
+        {
+            int threadCount = 0;
+            int testCount = 0;
+
+            Thread_ForEach(Enumerable.Range(0, 100), number =>
+            {
+                Interlocked.Increment(ref threadCount);
+                for (var i = 0; i < 100; i++)
+                {
+                    Interlocked.Increment(ref testCount);
+                    var name = $"{number}_{i}_{System.Guid.NewGuid()}";
+                    RunTestAsync(name).Wait();
+                }
+            });
+        }
+
+        void Thread_ForEach<T>(IEnumerable<T> source, Action<T> action, int msSleep = 10)
+        {
+            var threads = source.Select(i =>
+            {
+                var thread = new Thread(new ThreadStart(() => action(i)));
+                thread.Start();
+                return thread;
+            }).ToList();
+
+            while (true)
+            {
+                threads = threads.Where(t => t.IsAlive).ToList();
+                if (!threads.Any()) return;
+                Thread.Sleep(msSleep);
+            }
+        }
+        #endregion
+
+
+        #region Parallel
+        [TestMethod]
+        public void Test_Parallel()
+        {
+            int threadCount = 0;
+            int testCount = 0;
+
+            Parallel.ForEach(Enumerable.Range(0, 10)
+                //, new ParallelOptions { MaxDegreeOfParallelism = 1 }
+                , number =>
+                {
+                    Interlocked.Increment(ref threadCount);
+                    for (var i = 0; i < 100; i++)
+                    {
+                        Interlocked.Increment(ref testCount);
+                        var name = $"{number}_{i}_{System.Guid.NewGuid()}";
+                        RunTest(name);
+                    }
+                });
+        }
+
+        [TestMethod]
+        public void Test_ParallelAsync()
+        {
+            int threadCount = 0;
+            int testCount = 0;
+
+            Parallel.ForEach(Enumerable.Range(0, 10)
+                //, new ParallelOptions { MaxDegreeOfParallelism = 1 }
+                , async (number, token) =>
+                {
+                    Interlocked.Increment(ref threadCount);
+                    for (var i = 0; i < 100; i++)
+                    {
+                        Interlocked.Increment(ref testCount);
+                        var name = $"{number}_{i}_{System.Guid.NewGuid()}";
+                        await RunTestAsync(name);
+                    }
+                });
+        }
+
+        #endregion
+    }
+}

+ 66 - 0
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncCache_Test.cs

@@ -0,0 +1,66 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using System.Threading;
+using System.Threading.Tasks;
+
+using Vit.Core.Util.Threading.Cache;
+
+namespace Vit.Core.Util.Threading.MsTest.Cache
+{
+    [TestClass]
+    public class AsyncCache_Test : AsyncCache_BaseTest
+    {
+
+        AsyncCache<string> asyncCache = new AsyncCache<string>();
+
+        public override void RunTest(string name)
+        {
+            asyncCache.CreateScope();
+
+            //set
+            asyncCache.Value = name;
+
+            Thread.Sleep(10);
+
+            //get
+            var actual = asyncCache.Value;
+            Assert.AreEqual(name, actual);
+
+            asyncCache.DisposeScope();
+        }
+
+        public override async Task RunTestAsync(string name)
+        {
+            asyncCache.CreateScope();
+
+            //set
+            await Set(name);
+
+            await Task.Delay(8);
+
+            //get
+            var actual = await Get();
+
+            Assert.AreEqual(name, actual);
+
+            asyncCache.DisposeScope();
+        }
+
+        async Task Set(string name)
+        {
+            asyncCache.Value = name;
+            await Task.Delay(1);
+        }
+
+        async Task<string> Get()
+        {
+            var name = asyncCache.Value;
+            await Task.Delay(1);
+            return name;
+        }
+
+
+    }
+
+     
+}

+ 57 - 0
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Cache/AsyncLocal_Test.cs

@@ -0,0 +1,57 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Vit.Core.Util.Threading.MsTest.Cache
+{
+    [TestClass]
+    public class AsyncLocal_Test : AsyncCache_BaseTest
+    {
+
+        readonly System.Threading.AsyncLocal<string> AsyncLocal = new System.Threading.AsyncLocal<string>();
+
+        public override void RunTest(string name)
+        {
+            //set
+            AsyncLocal.Value = name;
+
+            Thread.Sleep(10);
+
+            //get
+            var actual = AsyncLocal.Value;
+            Assert.AreEqual(name, actual);
+        }
+
+        public override async Task RunTestAsync(string name)
+        {
+            //set
+            //await Set(name);
+            AsyncLocal.Value = name;
+
+            await Task.Delay(8);
+
+            //get
+            var actual = await Get();
+
+            Assert.AreEqual(name, actual);
+        }
+
+        async Task Set(string name)
+        {
+            AsyncLocal.Value = name;
+            await Task.Delay(1);
+        }
+
+        async Task<string> Get()
+        {
+            var name = AsyncLocal.Value;
+            await Task.Delay(1);
+            return name;
+        }
+
+
+    }
+
+     
+}

+ 8 - 6
dotnet/Library/Vit/Vit.Core/Test/Vit.Core.Util.Threading.MsTest/Worker/ManagedThread_Test.cs

@@ -1,6 +1,8 @@
 using Microsoft.VisualStudio.TestTools.UnitTesting;
+
 using System;
 using System.Threading;
+
 using Vit.Core.Util.Threading.Worker;
 
 namespace Vit.Core.Util.Threading.MsTest.Worker
@@ -15,20 +17,20 @@ namespace Vit.Core.Util.Threading.MsTest.Worker
             string errorMessage = "";
 
             var task = new ManagedThread<object>
-            {                 
+            {
                 Processor = (worker) =>
                 {
                     var _count = Interlocked.Increment(ref count);
                     Thread.Sleep(400);
                 },
-                OnFinish = (status,_count) =>
+                OnFinish = (status, _count) =>
                 {
-                    if( status == ETaskFinishStatus.timeout
+                    if (status == ETaskFinishStatus.timeout
                        || (status == ETaskFinishStatus.overload && (int)_count > 100)
-                    ) 
+                    )
                         return;
 
-                        errorMessage += Environment.NewLine + $"[{_count}]status : "+ status;
+                    errorMessage += Environment.NewLine + $"[{_count}]status : " + status;
                 }
             };
 
@@ -43,7 +45,7 @@ namespace Vit.Core.Util.Threading.MsTest.Worker
 
             for (var t = 0; t < 200; t++)
                 task.Publish(t);
-     
+
             Thread.Sleep(1050);
             task.OnFinish = null;
             task.Stop();

+ 3 - 3
dotnet/Library/Vit/Vit.Core/Vit.Core/Extensions/Json/TypeExtensions.cs

@@ -59,14 +59,15 @@ namespace Vit.Extensions.Json_Extensions
         #region GetUnderlyingTypeIfNullable
 
         /// <summary>
-        /// 若为Nullable类型(例如 long?)则获取对应的值类型(例如long),否则返回自身。
+        /// If it is NULLABLE, then get the underlying type. eg if "Nullable&lt;long&gt;" then this will return just "long"
         /// </summary>
         /// <param name="type"></param>
         /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static Type GetUnderlyingTypeIfNullable(this Type type)
         {
-            return type.IsNullable() ? type.GetGenericArguments()[0] : type;
+            //return type.IsNullable() ? type.GetGenericArguments()[0] : type;
+            return type.IsNullable() ? Nullable.GetUnderlyingType(type) : type;
 
 
             //if (type == null)
@@ -77,7 +78,6 @@ namespace Vit.Extensions.Json_Extensions
             ////Nullable.GetUnderlyingType(type);
 
             //// We need to check whether the property is NULLABLE
-            //// If it is NULLABLE, then get the underlying type. eg if "Nullable<long>" then this will return just "long"
             //return (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) ? type.GetGenericArguments()[0] : type;
         }
         #endregion

+ 1 - 1
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/ISerialization.cs

@@ -28,7 +28,7 @@ namespace Vit.Core.Module.Serialization
         /// <summary>
         /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
         /// </summary>
-        /// <param name="value"></param>    
+        /// <param name="value"></param>
         /// <returns></returns>
         T DeserializeFromString<T>(string value);
 

+ 76 - 3
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Json.cs

@@ -65,6 +65,58 @@ namespace Vit.Core.Module.Serialization
 
         #endregion
 
+        #region (x.1)object <--> String
+
+        /// <summary>
+        /// T也可为值类型(例如 int?、bool)
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static string Serialize<T>(T value)
+        {
+            return Instance.SerializeToString<T>(value);
+        }
+
+        /// <summary>
+        /// T也可为值类型(例如 int?、bool)
+        /// </summary>
+        /// <param name="value"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static string Serialize(object value, Type type)
+        {
+            return Instance.SerializeToString(value, type);
+        }
+
+
+
+        /// <summary>
+        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool)
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static T Deserialize<T>(string value)
+        {
+            return Instance.DeserializeFromString<T>(value);
+        }
+
+        /// <summary>
+        /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool)
+        /// </summary>
+        /// <param name="value"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static object Deserialize(string value, Type type)
+        {
+            return Instance.DeserializeFromString(value, type);
+        }
+
+        #endregion
 
 
         #region (x.2)object <--> bytes
@@ -117,6 +169,30 @@ namespace Vit.Core.Module.Serialization
             return Instance.DeserializeFromBytes(bytes, type);
         }
 
+        /// <summary>
+        /// type 可以为   byte[]、string、 object 、struct
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="bytes"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static T Deserialize<T>(byte[] bytes)
+        {
+            return Instance.DeserializeFromBytes<T>(bytes);
+        }
+
+        /// <summary>
+        /// type 可以为   byte[]、string、 object 、struct
+        /// </summary>
+        /// <param name="bytes"></param>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static object Deserialize(byte[] bytes, Type type)
+        {
+            return Instance.DeserializeFromBytes(bytes, type);
+        }
+
         #endregion
 
 
@@ -133,7 +209,6 @@ namespace Vit.Core.Module.Serialization
 
         #region (x.4)object <--> ArraySegmentByte
 
-
         /// <summary>
         /// 
         /// </summary>
@@ -146,8 +221,6 @@ namespace Vit.Core.Module.Serialization
         }
 
 
-
-
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes)
         {

+ 19 - 14
dotnet/Library/Vit/Vit.Core/Vit.Core/Module/Serialization/Serialization_Newtonsoft.cs

@@ -9,7 +9,7 @@ using Vit.Extensions.Newtonsoft_Extensions;
 
 namespace Vit.Core.Module.Serialization
 {
-    public class Serialization_Newtonsoft: ISerialization
+    public class Serialization_Newtonsoft : ISerialization
     {
         #region defaultEncoding
         public static Encoding defaultEncoding { get; set; } =
@@ -20,12 +20,12 @@ namespace Vit.Core.Module.Serialization
 
 
         public static readonly Serialization_Newtonsoft Instance = new Serialization_Newtonsoft();
-        
+
 
 
         #region 基础对象
 
-      
+
 
         #region 成员对象 
 
@@ -65,7 +65,7 @@ namespace Vit.Core.Module.Serialization
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public  byte[] StringToBytes(string data, Encoding encoding = null)
+        public byte[] StringToBytes(string data, Encoding encoding = null)
         {
             return (encoding ?? this.encoding).GetBytes(data);
         }
@@ -119,7 +119,7 @@ namespace Vit.Core.Module.Serialization
 
         public readonly Newtonsoft.Json.JsonSerializerSettings serializeSetting = new Newtonsoft.Json.JsonSerializerSettings();
 
-        public Serialization_Newtonsoft() 
+        public Serialization_Newtonsoft()
         {
 
             //忽略空值
@@ -154,8 +154,8 @@ namespace Vit.Core.Module.Serialization
         public string SerializeToString<T>(T value)
         {
             if (null == value) return null;
-         
-            return SerializeToString(value, value.GetType()); 
+
+            return SerializeToString(value, value.GetType());
         }
 
         /// <summary>
@@ -170,12 +170,17 @@ namespace Vit.Core.Module.Serialization
             if (null == value) return null;
 
             if (value is Newtonsoft.Json.Linq.JToken token)
-            {             
-                if(token.TypeMatch(JTokenType.String)) return token.ToString();
+            {
+                if (token.TypeMatch(JTokenType.String)) return token.ToString();
 
                 return token.ToString(serializeSetting.Formatting);
             }
 
+            if (value is DateTime time)
+            {
+                return time.ToString(serializeSetting.DateFormatString);
+            }
+
             if (type.TypeIsValueTypeOrStringType())
             {
                 //return value.Convert<string>();
@@ -191,7 +196,7 @@ namespace Vit.Core.Module.Serialization
         /// <summary>
         /// 使用Newtonsoft反序列化。T也可为值类型(例如 int?、bool) 
         /// </summary>
-        /// <param name="value"></param>    
+        /// <param name="value"></param>
         /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public T DeserializeFromString<T>(string value)
@@ -256,9 +261,9 @@ namespace Vit.Core.Module.Serialization
         /// <param name="obj"></param>
         /// <returns></returns>
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public byte[] SerializeToBytes<T>(T obj) 
+        public byte[] SerializeToBytes<T>(T obj)
         {
-            return SerializeToBytes<T>(obj,null);
+            return SerializeToBytes<T>(obj, null);
         }
 
         /// <summary>
@@ -409,10 +414,10 @@ namespace Vit.Core.Module.Serialization
 
 
         #region DeserializeFromArraySegmentByte
- 
+
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public  T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes)
+        public T DeserializeFromArraySegmentByte<T>(ArraySegment<byte> bytes)
         {
             if (bytes.Count == 0) return default;
             return (T)DeserializeFromArraySegmentByte(bytes, typeof(T));

+ 72 - 19
dotnet/Library/Vit/Vit.Core/Vit.Core/Util/Threading/Cache/AsyncCache.cs

@@ -1,8 +1,8 @@
-#region << 版本注释 - v1 >>
+#region << Comment - v3 >>
 /*
  * ========================================================================
- * 版本:v1
- * 时间:2021-03-19
+ * 版本:v3
+ * 时间:2023-11-15
  * 作者:Lith
  * 邮箱:serset@yeah.net
  * 
@@ -12,41 +12,94 @@
 
 
 using System;
-using System.Collections.Generic;
-using System.Text;
- 
 
 namespace Vit.Core.Util.Threading.Cache
 {
+    public abstract class AsyncCacheScope<ScopeType> : IDisposable
+        where ScopeType : AsyncCacheScope<ScopeType>
+    {
+        public AsyncCacheScope()
+        {
+            Instance_AsyncCache.CreateScope(this as ScopeType);
+        }
+        public virtual void Dispose()
+        {
+            Instance_AsyncCache.DisposeScope();
+        }
+
+        static AsyncCache<ScopeType> Instance_AsyncCache = new AsyncCache<ScopeType>();
+
+        public static ScopeType Instance => Instance_AsyncCache.Value;
+    }
+
+
     /// <summary>
     /// 切换线程时依然可以传递数据。(若切换线程不传递则可使用System.Threading.ThreadLocal ,或者使用[ThreadStatic]特性)
     /// 多包裹一层的原因是 子异步任务结束时会还原子异步任务对AsyncLocal做的更改(即子异步任务对AsyncLocal做的更改不会保留到子异步任务结束后的父异步任务中)
-    /// 参见https://blog.csdn.net/kkfd1002/article/details/80102244
+    /// 参见 https://blog.csdn.net/kkfd1002/article/details/80102244
     /// </summary>
-    public class AsyncCache<T>
+    public class AsyncCache<DataType>
     {
 
-        readonly System.Threading.AsyncLocal<CachedData> _AsyncLocal = new System.Threading.AsyncLocal<CachedData>();
+        readonly System.Threading.AsyncLocal<DataWrap> _AsyncLocal = new System.Threading.AsyncLocal<DataWrap>();
+
+        class DataWrap : IDisposable
+        {
+            internal Action OnDispose;
+            internal DataType data;
 
-        class CachedData
+            public void Dispose()
+            {
+                OnDispose?.Invoke();
+            }
+        }
+        public void CreateScope()
         {
-            public T Cache;
+            _AsyncLocal.Value = new DataWrap();
         }
-        public T Value
+        public void CreateScope(DataType value)
+        {
+            _AsyncLocal.Value = new DataWrap { data = value };
+        }
+
+        public IDisposable NewScope()
+        {
+            var wrap = new DataWrap { OnDispose = DisposeScope };
+            _AsyncLocal.Value = wrap;
+            return wrap;
+        }
+        public IDisposable NewScope(DataType value)
+        {
+            var wrap = new DataWrap { OnDispose = DisposeScope, data = value };
+            _AsyncLocal.Value = wrap;
+            return wrap;
+        }
+
+
+        public void DisposeScope()
+        {
+            _AsyncLocal.Value = null;
+        }
+        public bool SetValue(DataType value)
+        {
+            var dataWrap = _AsyncLocal.Value;
+            if (dataWrap == null) return false;
+            dataWrap.data = value;
+            return true;
+        }
+        public DataType Value
         {
             get
             {
-                if (null == _AsyncLocal.Value)
-                    return default(T);
-                return _AsyncLocal.Value.Cache;
+                var dataWrap = _AsyncLocal.Value;
+                if (dataWrap == null) return default;
+                return dataWrap.data;
             }
             set
             {
-                var asyncLocal = _AsyncLocal.Value;
-                if (null == asyncLocal) asyncLocal = _AsyncLocal.Value = new CachedData();
-                asyncLocal.Cache = value;
+                SetValue(value);
             }
         }
     }
-   
+
 }

+ 0 - 49
dotnet/Library/Vit/Vit.Core/Vit.Core/Util/Threading/Cache/AsyncCacheHelper.cs

@@ -1,49 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-
-
-namespace Vit.Core.Util.Threading.Cache
-{
-    public class AsyncCacheHelper
-    {
-        static  AsyncCache<ConcurrentDictionary<string,object>> _AsyncCache = new AsyncCache<ConcurrentDictionary<string, object>>();
-        static ConcurrentDictionary<string, object> dic
-        {
-            get
-            {
-                return _AsyncCache.Value ?? (_AsyncCache.Value = new ConcurrentDictionary<string, object>());                
-            }             
-        }
-
-        [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
-        public static void Set(string key,Object value)
-        {
-            dic[key] = value;
-        }
-
-        [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
-        public static Object Get(string key)
-        {
-            if (dic.TryGetValue(key, out var value))
-            {
-                return value;
-            }
-            return null;
-        }
-
-        [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
-        public static T Get<T>(string key)
-        {
-            try
-            {
-                if (dic.TryGetValue(key, out var value))
-                {
-                    return (T)value;
-                }
-            }
-            catch { }           
-            return default(T);
-        }
-
-    }
-}

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.18</Version>
+        <Version>2.1.19-preview</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.18</Version>
+        <Version>2.1.19-preview</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.18</Version>
+        <Version>2.1.19-preview</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -8,7 +8,7 @@
     <PropertyGroup>
         <OutputType>Exe</OutputType>
         <TargetFramework>net6.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
         <PackageProjectUrl>https://github.com/serset/Sers</PackageProjectUrl>
     </PropertyGroup>
 

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

@@ -8,7 +8,7 @@
     <PropertyGroup>
         <OutputType>Exe</OutputType>
         <TargetFramework>net6.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
         <PackageProjectUrl>https://github.com/serset/Sers</PackageProjectUrl>
     </PropertyGroup>
 

+ 20 - 19
dotnet/ServiceCenter/Sers.ServiceCenter/Sers.Gover/Base/GoverApiCenterService.cs

@@ -33,7 +33,7 @@ namespace Sers.Gover.Base
         public static readonly GoverApiCenterService Instance = LoadFromFile();
         static GoverApiCenterService LoadFromFile()
         {
-            var mng=new GoverApiCenterService();
+            var mng = new GoverApiCenterService();
 
             Persistence_ApiDesc.ApiDesc_LoadAllFromJsonFile(mng.apiStationMng);
             Persistence_Counter.LoadCounterFromJsonFile(mng.apiStationMng);
@@ -42,11 +42,11 @@ namespace Sers.Gover.Base
         }
         public static void SaveToFile()
         {
-            Persistence_Counter.SaveCounterToJsonFile(Instance.apiStationMng); 
+            Persistence_Counter.SaveCounterToJsonFile(Instance.apiStationMng);
         }
         #endregion
 
- 
+
 
 
 
@@ -67,7 +67,7 @@ namespace Sers.Gover.Base
             apiStationMng.Init(this);
         }
 
-        
+
 
         internal readonly ApiLoadBalancingMng apiLoadBalancingMng;
 
@@ -93,7 +93,7 @@ namespace Sers.Gover.Base
         public IEnumerable<SsApiDesc> ApiDesc_GetActive()
         {
             return apiLoadBalancingMng.GetAllApiDesc();
-        
+
         }
 
         public IEnumerable<SsApiDesc> ApiDesc_GetAll()
@@ -138,7 +138,7 @@ namespace Sers.Gover.Base
                 #endregion
 
 
-                #region (x.1)route 判空               
+                #region (x.1)route 判空
                 if (string.IsNullOrWhiteSpace(rpcData.route))
                 {
                     //返回api 不存在
@@ -148,7 +148,7 @@ namespace Sers.Gover.Base
                 #endregion
 
 
-                #region (x.2) 服务限流 BeforeLoadBalancing               
+                #region (x.2) 服务限流 BeforeLoadBalancing
                 var error = rateLimitMng.BeforeLoadBalancing(rpcData, requestMessage);
                 if (null != error)
                 {
@@ -157,7 +157,7 @@ namespace Sers.Gover.Base
                 }
                 #endregion
 
-                #region (x.3) 负载均衡,获取对应服务端                
+                #region (x.3) 负载均衡,获取对应服务端
                 var apiNode = apiLoadBalancingMng.GetCurApiNodeByLoadBalancing(rpcData, out var routeType);
 
                 if (null == apiNode)
@@ -231,14 +231,15 @@ namespace Sers.Gover.Base
 
 
                 //(x.x.2) 修正 requestMessage
-                if (requestMessage.rpcContextData_OriData.Count <= 0) {
+                if (requestMessage.rpcContextData_OriData.Count <= 0)
+                {
                     requestMessage.RpcContextData_OriData_Set(rpcData);
                 }
-                #endregion             
+                #endregion
 
 
                 #region (x.8)服务调用
-                apiNode.CallApiAsync(rpcData, requestMessage, sender,callback);                
+                apiNode.CallApiAsync(rpcData, requestMessage, sender, callback);
                 #endregion
 
             }
@@ -247,7 +248,7 @@ namespace Sers.Gover.Base
                 Logger.Error(ex);
 
                 ApiSysError.LogSysError(rpcData, requestMessage, ex.ToSsError());
- 
+
                 SendReply(SsError.Err_SysErr);
                 return;
             }
@@ -259,7 +260,7 @@ namespace Sers.Gover.Base
                 callback(sender, new ApiMessage().InitAsApiReplyMessageByError(error).Package());
             }
 
-          
+
 
         }
         #endregion
@@ -290,9 +291,9 @@ namespace Sers.Gover.Base
         }
 
 
-        public override void ServiceStation_Remove(IOrganizeConnection  conn)
+        public override void ServiceStation_Remove(IOrganizeConnection conn)
         {
-            string connKey = ""+ conn.GetHashCode();
+            string connKey = "" + conn.GetHashCode();
             var serviceStation = serviceStationMng.ServiceStation_Remove(connKey);
             if (serviceStation != null)
             {
@@ -307,7 +308,7 @@ namespace Sers.Gover.Base
             if (serviceStation != null)
             {
                 Logger.Info("[ApiCenterService]Pause serviceStation", new { stationName = serviceStation?.serviceStationInfo?.serviceStationName });
-            } 
+            }
             return serviceStation != null;
         }
 
@@ -318,7 +319,7 @@ namespace Sers.Gover.Base
             {
                 Logger.Info("[ApiCenterService]Start serviceStation", new { stationName = serviceStation?.serviceStationInfo?.serviceStationName });
             }
-            return serviceStation != null; 
+            return serviceStation != null;
         }
 
         public bool ServiceStation_Stop(string connKey)
@@ -367,9 +368,9 @@ namespace Sers.Gover.Base
         /// 在调用api前调用onScope,若onScope返回的结果(onDispose)不为空,则在api调用结束前调用onDispose
         /// </summary>
         /// <param name="apiScopeEvent"></param>
-        public void AddApiScopeEvent(Func<RpcContextData, ApiMessage, Action<Object, Vit.Core.Util.Pipelines.ByteData>> apiScopeEvent) 
+        public void AddApiScopeEvent(Func<RpcContextData, ApiMessage, Action<Object, Vit.Core.Util.Pipelines.ByteData>> apiScopeEvent)
         {
-            if (apiScopeEventList == null) apiScopeEventList=new List<Func<RpcContextData, ApiMessage, Action<Object, Vit.Core.Util.Pipelines.ByteData>>>();
+            if (apiScopeEventList == null) apiScopeEventList = new List<Func<RpcContextData, ApiMessage, Action<Object, Vit.Core.Util.Pipelines.ByteData>>>();
 
             apiScopeEventList.Add(apiScopeEvent);
         }

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -6,7 +6,7 @@
 
     <PropertyGroup>
         <TargetFramework>netstandard2.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
     </PropertyGroup>
 
     <PropertyGroup>

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

@@ -8,7 +8,7 @@
     <PropertyGroup>
         <OutputType>Exe</OutputType>
         <TargetFramework>net6.0</TargetFramework>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
         <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
         <Description>https://github.com/serset/Sers</Description>
     </PropertyGroup>

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

@@ -9,7 +9,7 @@
         <OutputType>Exe</OutputType>
         <TargetFramework>net6.0</TargetFramework>
         <RunPostBuildEvent>Always</RunPostBuildEvent>
-        <Version>2.1.21</Version>
+        <Version>2.1.22-temp</Version>
         <Description>https://github.com/serset/Sers</Description>
     </PropertyGroup>