Skip to content

Commit cd93158

Browse files
authored
Merge pull request #319 from Senparc/Develop
Develop
2 parents 859d5bf + 77a93e2 commit cd93158

File tree

22 files changed

+188
-160
lines changed

22 files changed

+188
-160
lines changed

Sample/Senparc.CO2NET.Sample.net8/Senparc.CO2NET.Sample.net8.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
1515
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.0" />
1616

17-
<PackageReference Include="Senparc.Weixin.MP" Version="16.22.1" />
17+
<PackageReference Include="Senparc.Weixin.MP" Version="16.23.6" />
1818

1919
<ProjectReference Include="..\..\src\Senparc.CO2NET.APM\Senparc.CO2NET.APM.csproj" />
2020
<ProjectReference Include="..\..\src\Senparc.CO2NET.AspNet\Senparc.CO2NET.AspNet.csproj" />

src/Senparc.CO2NET.APM/Senparc.CO2NET.APM.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4-
<Version>2.0.1-beta1</Version>
4+
<Version>2.1.0-beta1</Version>
55
<AssemblyName>Senparc.CO2NET.APM</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.APM</RootNamespace>
77
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
@@ -37,6 +37,7 @@
3737
v1.1.0 APM is disabled by default (EnableAPM = false)
3838
[2024-09-11] v1.4.6 Update Cache, remove InsertToCache(), add Count(prefix)
3939
[2024-11-28] v2.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
40+
[2024-12-04] v2.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
4041
</PackageReleaseNotes>
4142
</PropertyGroup>
4243
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

src/Senparc.CO2NET.AspNet/Register.cs

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,29 @@
1212
Modification Identifier: Senparc - 20240728
1313
Modification Description: v1.4.0 .NET 6.0 and .NET 8.0 assemblies no longer depend on Microsoft.AspNetCore.Hosting.Abstractions and Microsoft.AspNetCore.Http.Abstractions
1414
15-
----------------------------------------------------------------*/
16-
17-
#if !NET462
18-
using Microsoft.AspNetCore.Builder;
19-
using System;
20-
using System.Collections.Generic;
21-
using System.Text;
22-
using Senparc.CO2NET.Cache;
23-
using Senparc.CO2NET.RegisterServices;
24-
using Microsoft.Extensions.Options;
25-
using Microsoft.Extensions.DependencyInjection;
26-
#endif
27-
28-
namespace Senparc.CO2NET.AspNet
29-
{
15+
----------------------------------------------------------------*/
16+
17+
18+
#if !NET462
19+
using Microsoft.AspNetCore.Builder;
20+
using System;
21+
using System.Collections.Generic;
22+
using System.Text;
23+
using Senparc.CO2NET.Cache;
24+
using Senparc.CO2NET.RegisterServices;
25+
using Microsoft.Extensions.Options;
26+
using Microsoft.Extensions.DependencyInjection;
27+
#endif
28+
29+
namespace Senparc.CO2NET.AspNet
30+
{
3031
/// <summary>
3132
/// Senparc.CO2NET.AspNet Basic Information Registration
3233
/// </summary>
33-
public static class Register
34-
{
35-
#if !NET462
36-
34+
public static class Register
35+
{
36+
#if !NET462
37+
3738
/// <summary>
3839
/// Start Senparc.CO2NET initialization parameter process (ASP.NET Core)
3940
/// </summary>
@@ -46,21 +47,21 @@ public static class Register
4647
/// <para>(LocalContainerCacheStrategy, RedisContainerCacheStrategy, MemcacheContainerCacheStrategy are already automatically registered),</para>
4748
/// <para>If set to null (note: not delegate returns null, but the entire delegate parameter is null), it will automatically use reflection to scan all possible extension cache strategies</para></param>
4849
/// <returns></returns>
49-
public static IRegisterService UseSenparcGlobal(this IApplicationBuilder registerService,
50-
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env,
51-
SenparcSetting senparcSetting = null,
52-
Action<RegisterService> registerConfigure = null,
53-
bool autoScanExtensionCacheStrategies = false,
54-
Func<IList<IDomainExtensionCacheStrategy>> extensionCacheStrategiesFunc = null)
55-
{
56-
senparcSetting = senparcSetting ?? registerService.ApplicationServices.GetService<IOptions<SenparcSetting>>().Value;
57-
50+
public static IRegisterService UseSenparcGlobal(this IApplicationBuilder registerService,
51+
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env,
52+
SenparcSetting senparcSetting = null,
53+
Action<RegisterService> registerConfigure = null,
54+
bool autoScanExtensionCacheStrategies = false,
55+
Func<IList<IDomainExtensionCacheStrategy>> extensionCacheStrategiesFunc = null)
56+
{
57+
senparcSetting = senparcSetting ?? Senparc.CO2NET.Config.SenparcSetting; /*registerService.ApplicationServices.GetService<IOptions<SenparcSetting>>().Value;*/
58+
5859
//Initialize the global RegisterService object and store SenparcSetting information
59-
var register = Senparc.CO2NET.AspNet.RegisterServices.
60-
RegisterService.Start(env, senparcSetting);
61-
62-
return Senparc.CO2NET.Register.UseSenparcGlobal(senparcSetting, registerConfigure, autoScanExtensionCacheStrategies, extensionCacheStrategiesFunc);
63-
}
64-
#endif
65-
}
66-
}
60+
var register = Senparc.CO2NET.AspNet.RegisterServices.
61+
RegisterService.Start(env/*, senparcSetting*/);
62+
63+
return Senparc.CO2NET.Register.UseSenparcGlobal(senparcSetting, registerConfigure, autoScanExtensionCacheStrategies, extensionCacheStrategiesFunc);
64+
}
65+
#endif
66+
}
67+
}

src/Senparc.CO2NET.AspNet/RegisterServices/RegisterService.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ public static class RegisterService
3737
/// Start Senparc.CO2NET SDK initialization parameter process (.NET Core), supports ASP.NET Core
3838
/// </summary>
3939
/// <param name="env">IHostingEnvironment, console programs can input null,</param>
40-
/// <param name="senparcSetting"></param>
4140
/// <returns></returns>
4241
public static Senparc.CO2NET.RegisterServices.RegisterService Start(
43-
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env,
44-
SenparcSetting senparcSetting)
42+
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env
43+
, SenparcSetting senparcSetting = null)
4544
{
4645
//Provide website root directory
4746
if (env != null && env.ContentRootPath != null)

src/Senparc.CO2NET.AspNet/Senparc.CO2NET.AspNet.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
4-
<Version>2.0.1-beta1</Version>
4+
<Version>2.1.0-beta1</Version>
55
<AssemblyName>Senparc.CO2NET.AspNet</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.AspNet</RootNamespace>
77
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
@@ -33,6 +33,7 @@
3333
[2024-09-11] v1.4.3 Update Cache, remove InsertToCache(), add Count(prefix)
3434
[2024-10-07] v1.5.0 Stop supporting .NET 6.0
3535
[2024-11-28] v2.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
36+
[2024-12-04] v2.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
3637
</PackageReleaseNotes>
3738
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
3839
<Configurations>Debug;Release;Test</Configurations>

src/Senparc.CO2NET.Cache.CsRedis.Tests/InitTests.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@ public void AutoRegisterConfigurationTest()
3535

3636
var redisServer = "localhost:6379";
3737

38-
var senparcSetting = new SenparcSetting()
39-
{
40-
IsDebug = true,
41-
Cache_Redis_Configuration = redisServer
42-
};
38+
Senparc.CO2NET.Config.SenparcSetting.IsDebug = true;
39+
Senparc.CO2NET.Config.SenparcSetting.Cache_Redis_Configuration = redisServer;
40+
41+
42+
//var senparcSetting = new SenparcSetting()
43+
//{
44+
// IsDebug = true,
45+
// Cache_Redis_Configuration = redisServer
46+
//};
4347

4448

4549
var registerService = Senparc.CO2NET.AspNet.RegisterServices.
46-
RegisterService.Start(mockEnv.Object, senparcSetting)
50+
RegisterService.Start(mockEnv.Object/*, senparcSetting*/)
4751
.UseSenparcGlobal();
4852
Assert.AreEqual(null, RedisManager.ConfigurationOption);// Not registered yet
4953

src/Senparc.CO2NET.Cache.CsRedis/Senparc.CO2NET.Cache.CsRedis.csproj

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4-
<Version>2.1.1-beta1</Version>
4+
<Version>2.2.0-beta1</Version>
55
<AssemblyName>Senparc.CO2NET.Cache.CsRedis</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.Cache.CsRedis</RootNamespace>
77
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
88
<Description>
9-
CONET cache strategy - Redis module
9+
CONET cache strategy - Redis module
1010

11-
CO2NET open source project:
12-
https://github.com/Senparc/Senparc.CO2NET
13-
</Description>
11+
CO2NET open source project:
12+
https://github.com/Senparc/Senparc.CO2NET
13+
</Description>
1414
<Copyright>Senparc Copyright © 2004~2024</Copyright>
1515
<PackageTags>Senparc.CO2NET,Cache,Redis,CO2NET,盛派</PackageTags>
1616
<Authors>Jeffrey Su</Authors>
@@ -22,14 +22,15 @@
2222
<PackageProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</PackageProjectUrl>
2323
<PackageIcon>icon.jpg</PackageIcon>
2424
<PackageReleaseNotes>
25-
v0.1.0 Genesis
26-
v0.5.2 BaseRedisObjectCacheStrategy destructor performs null value check and adds "#{Cache_Redis_Configuration}#" filter check
27-
v1.1.4 RedisObjectCacheStrategy and RedisHashSetObjectCacheStrategy.Get() methods add pure string check
28-
v1.2.5 Fix bug where GetAllByPrefixAsync(key) method automatically retrieves all keys
29-
[2024-09-11] v1.2.6 Update Cache, remove InsertToCache(), add Count(prefix)
25+
v0.1.0 Genesis
26+
v0.5.2 BaseRedisObjectCacheStrategy destructor performs null value check and adds "#{Cache_Redis_Configuration}#" filter check
27+
v1.1.4 RedisObjectCacheStrategy and RedisHashSetObjectCacheStrategy.Get() methods add pure string check
28+
v1.2.5 Fix bug where GetAllByPrefixAsync(key) method automatically retrieves all keys
29+
[2024-09-11] v1.2.6 Update Cache, remove InsertToCache(), add Count(prefix)
3030
[2024-10-24] v2.0.1-beta1 fix: GetCountAsync(string prefix) #306 Thanks to @rendyu
3131
[2024-11-28] v2.1.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
32-
</PackageReleaseNotes>
32+
[2024-12-04] v2.2.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
33+
</PackageReleaseNotes>
3334
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
3435
<Configurations>Debug;Release;Test</Configurations>
3536
</PropertyGroup>

src/Senparc.CO2NET.Cache.Dapr/Senparc.CO2NET.Cache.Dapr.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>net8.0</TargetFramework>
4-
<Version>1.0.1-beta1</Version>
4+
<Version>1.1.0-beta1</Version>
55
<AssemblyName>Senparc.CO2NET.Cache.Dapr</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.Cache.Dapr</RootNamespace>
77
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
@@ -25,7 +25,8 @@
2525
v0.1.0 Genesis
2626
[2024-09-11] v0.1.3 Update Cache, remove InsertToCache(), add Count(prefix)
2727
[2024-11-28] v1.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
28-
</PackageReleaseNotes>
28+
[2024-12-04] v1.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
29+
</PackageReleaseNotes>
2930
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
3031
<Configurations>Debug;Release;Test</Configurations>
3132
</PropertyGroup>

src/Senparc.CO2NET.Cache.Memcached/Senparc.CO2NET.Cache.Memcached.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net462;netstandard2.0;net8.0</TargetFrameworks>
4-
<Version>5.0.1-beta1</Version>
4+
<Version>5.1.0-beta1</Version>
55
<AssemblyName>Senparc.CO2NET.Cache.Memcached</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.Cache.Memcached</RootNamespace>
77
<Description>
@@ -91,7 +91,8 @@
9191
[2024-09-11] v4.2.5 Update Cache, remove InsertToCache(), add Count(prefix)
9292
[2024-10-07] v4.3.0 Stop supporting .NET 6.0
9393
[2024-11-28] v5.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
94-
</PackageReleaseNotes>
94+
[2024-12-04] v5.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
95+
</PackageReleaseNotes>
9596
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
9697
<Configurations>Debug;Release;Test</Configurations>
9798
<!--<Product>Senparc.CO2NET.Cache.Memcached.dll</Product>-->

src/Senparc.CO2NET.Cache.Redis.RedLock/redlock-cs/src/Senparc.CO2NET.Cache.Redis.RedLock.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4-
<Version>4.0.1-beta1</Version>
4+
<Version>4.1.0-beta1</Version>
55
<AssemblyName>Senparc.CO2NET.Cache.Redis.RedLock</AssemblyName>
66
<RootNamespace>Senparc.CO2NET.Cache.Redis.RedLock</RootNamespace>
77
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
@@ -56,6 +56,7 @@
5656
v2.2.1 Used .ConfigureAwait(false) to avoid asynchronous deadlock
5757
v2.2.4 Provided signed nuget package (.snupkg)
5858
[2024-11-28] v4.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
59+
[2024-12-04] v4.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
5960
</PackageReleaseNotes>
6061
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
6162
<Configurations>Debug;Release;Test</Configurations>

0 commit comments

Comments
 (0)