Skip to content

Commit

Permalink
merge from Develop-AddSetting
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySu committed Dec 4, 2024
2 parents 82ae7f2 + eb9ed5c commit 77a93e2
Show file tree
Hide file tree
Showing 22 changed files with 153 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="8.0.0" />

<PackageReference Include="Senparc.Weixin.MP" Version="16.22.1" />
<PackageReference Include="Senparc.Weixin.MP" Version="16.23.6" />

<ProjectReference Include="..\..\src\Senparc.CO2NET.APM\Senparc.CO2NET.APM.csproj" />
<ProjectReference Include="..\..\src\Senparc.CO2NET.AspNet\Senparc.CO2NET.AspNet.csproj" />
Expand Down
3 changes: 2 additions & 1 deletion src/Senparc.CO2NET.APM/Senparc.CO2NET.APM.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Version>2.0.1-beta1</Version>
<Version>2.1.0-beta1</Version>
<AssemblyName>Senparc.CO2NET.APM</AssemblyName>
<RootNamespace>Senparc.CO2NET.APM</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -37,6 +37,7 @@
v1.1.0 APM is disabled by default (EnableAPM = false)
[2024-09-11] v1.4.6 Update Cache, remove InsertToCache(), add Count(prefix)
[2024-11-28] v2.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
[2024-12-04] v2.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
Expand Down
4 changes: 2 additions & 2 deletions src/Senparc.CO2NET.AspNet/Register.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public static IRegisterService UseSenparcGlobal(this IApplicationBuilder registe
bool autoScanExtensionCacheStrategies = false,
Func<IList<IDomainExtensionCacheStrategy>> extensionCacheStrategiesFunc = null)
{
senparcSetting = senparcSetting ?? registerService.ApplicationServices.GetService<IOptions<SenparcSetting>>().Value;
senparcSetting = senparcSetting ?? Senparc.CO2NET.Config.SenparcSetting; /*registerService.ApplicationServices.GetService<IOptions<SenparcSetting>>().Value;*/

//Initialize the global RegisterService object and store SenparcSetting information
var register = Senparc.CO2NET.AspNet.RegisterServices.
RegisterService.Start(env, senparcSetting);
RegisterService.Start(env/*, senparcSetting*/);

return Senparc.CO2NET.Register.UseSenparcGlobal(senparcSetting, registerConfigure, autoScanExtensionCacheStrategies, extensionCacheStrategiesFunc);
}
Expand Down
5 changes: 2 additions & 3 deletions src/Senparc.CO2NET.AspNet/RegisterServices/RegisterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ public static class RegisterService
/// Start Senparc.CO2NET SDK initialization parameter process (.NET Core), supports ASP.NET Core
/// </summary>
/// <param name="env">IHostingEnvironment, console programs can input null,</param>
/// <param name="senparcSetting"></param>
/// <returns></returns>
public static Senparc.CO2NET.RegisterServices.RegisterService Start(
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env,
SenparcSetting senparcSetting)
Microsoft.Extensions.Hosting.IHostEnvironment/*IHostingEnvironment*/ env
, SenparcSetting senparcSetting = null)
{
//Provide website root directory
if (env != null && env.ContentRootPath != null)
Expand Down
3 changes: 2 additions & 1 deletion src/Senparc.CO2NET.AspNet/Senparc.CO2NET.AspNet.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
<Version>2.0.1-beta1</Version>
<Version>2.1.0-beta1</Version>
<AssemblyName>Senparc.CO2NET.AspNet</AssemblyName>
<RootNamespace>Senparc.CO2NET.AspNet</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -33,6 +33,7 @@
[2024-09-11] v1.4.3 Update Cache, remove InsertToCache(), add Count(prefix)
[2024-10-07] v1.5.0 Stop supporting .NET 6.0
[2024-11-28] v2.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
[2024-12-04] v2.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
<Configurations>Debug;Release;Test</Configurations>
Expand Down
16 changes: 10 additions & 6 deletions src/Senparc.CO2NET.Cache.CsRedis.Tests/InitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ public void AutoRegisterConfigurationTest()

var redisServer = "localhost:6379";

var senparcSetting = new SenparcSetting()
{
IsDebug = true,
Cache_Redis_Configuration = redisServer
};
Senparc.CO2NET.Config.SenparcSetting.IsDebug = true;
Senparc.CO2NET.Config.SenparcSetting.Cache_Redis_Configuration = redisServer;


//var senparcSetting = new SenparcSetting()
//{
// IsDebug = true,
// Cache_Redis_Configuration = redisServer
//};


var registerService = Senparc.CO2NET.AspNet.RegisterServices.
RegisterService.Start(mockEnv.Object, senparcSetting)
RegisterService.Start(mockEnv.Object/*, senparcSetting*/)
.UseSenparcGlobal();
Assert.AreEqual(null, RedisManager.ConfigurationOption);// Not registered yet

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Version>2.1.1-beta1</Version>
<Version>2.2.0-beta1</Version>
<AssemblyName>Senparc.CO2NET.Cache.CsRedis</AssemblyName>
<RootNamespace>Senparc.CO2NET.Cache.CsRedis</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
<Description>
CONET cache strategy - Redis module
CONET cache strategy - Redis module

CO2NET open source project:
https://github.com/Senparc/Senparc.CO2NET
</Description>
CO2NET open source project:
https://github.com/Senparc/Senparc.CO2NET
</Description>
<Copyright>Senparc Copyright © 2004~2024</Copyright>
<PackageTags>Senparc.CO2NET,Cache,Redis,CO2NET,盛派</PackageTags>
<Authors>Jeffrey Su</Authors>
Expand All @@ -22,14 +22,15 @@
<PackageProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</PackageProjectUrl>
<PackageIcon>icon.jpg</PackageIcon>
<PackageReleaseNotes>
v0.1.0 Genesis
v0.5.2 BaseRedisObjectCacheStrategy destructor performs null value check and adds "#{Cache_Redis_Configuration}#" filter check
v1.1.4 RedisObjectCacheStrategy and RedisHashSetObjectCacheStrategy.Get() methods add pure string check
v1.2.5 Fix bug where GetAllByPrefixAsync(key) method automatically retrieves all keys
[2024-09-11] v1.2.6 Update Cache, remove InsertToCache(), add Count(prefix)
v0.1.0 Genesis
v0.5.2 BaseRedisObjectCacheStrategy destructor performs null value check and adds "#{Cache_Redis_Configuration}#" filter check
v1.1.4 RedisObjectCacheStrategy and RedisHashSetObjectCacheStrategy.Get() methods add pure string check
v1.2.5 Fix bug where GetAllByPrefixAsync(key) method automatically retrieves all keys
[2024-09-11] v1.2.6 Update Cache, remove InsertToCache(), add Count(prefix)
[2024-10-24] v2.0.1-beta1 fix: GetCountAsync(string prefix) #306 Thanks to @rendyu
[2024-11-28] v2.1.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
</PackageReleaseNotes>
[2024-12-04] v2.2.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
<Configurations>Debug;Release;Test</Configurations>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.0.1-beta1</Version>
<Version>1.1.0-beta1</Version>
<AssemblyName>Senparc.CO2NET.Cache.Dapr</AssemblyName>
<RootNamespace>Senparc.CO2NET.Cache.Dapr</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand All @@ -25,7 +25,8 @@
v0.1.0 Genesis
[2024-09-11] v0.1.3 Update Cache, remove InsertToCache(), add Count(prefix)
[2024-11-28] v1.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
</PackageReleaseNotes>
[2024-12-04] v1.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
<Configurations>Debug;Release;Test</Configurations>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;net8.0</TargetFrameworks>
<Version>5.0.1-beta1</Version>
<Version>5.1.0-beta1</Version>
<AssemblyName>Senparc.CO2NET.Cache.Memcached</AssemblyName>
<RootNamespace>Senparc.CO2NET.Cache.Memcached</RootNamespace>
<Description>
Expand Down Expand Up @@ -91,7 +91,8 @@
[2024-09-11] v4.2.5 Update Cache, remove InsertToCache(), add Count(prefix)
[2024-10-07] v4.3.0 Stop supporting .NET 6.0
[2024-11-28] v5.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
</PackageReleaseNotes>
[2024-12-04] v5.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
<Configurations>Debug;Release;Test</Configurations>
<!--<Product>Senparc.CO2NET.Cache.Memcached.dll</Product>-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<Version>4.0.1-beta1</Version>
<Version>4.1.0-beta1</Version>
<AssemblyName>Senparc.CO2NET.Cache.Redis.RedLock</AssemblyName>
<RootNamespace>Senparc.CO2NET.Cache.Redis.RedLock</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -56,6 +56,7 @@
v2.2.1 Used .ConfigureAwait(false) to avoid asynchronous deadlock
v2.2.4 Provided signed nuget package (.snupkg)
[2024-11-28] v4.0.1-beta1 Add UseLowerCaseApiName property for SenparcSetting
[2024-12-04] v4.1.0-beta1 update Start() method, set SenparcSetting in Config when AddSenparcGlobalService() run
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
<Configurations>Debug;Release;Test</Configurations>
Expand Down
15 changes: 9 additions & 6 deletions src/Senparc.CO2NET.Cache.Redis.Tests/InitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ public void AutoRegisterConfigurationTest()

var redisServer = "localhost:6379";

var senparcSetting = new SenparcSetting()
{
IsDebug = true,
Cache_Redis_Configuration = redisServer
};
Senparc.CO2NET.Config.SenparcSetting.IsDebug = true;
Senparc.CO2NET.Config.SenparcSetting.Cache_Redis_Configuration = redisServer;


//var senparcSetting = new SenparcSetting()
//{
// IsDebug = true,
// Cache_Redis_Configuration = redisServer
//};

var registerService = Senparc.CO2NET.AspNet.RegisterServices.
RegisterService.Start(mockEnv.Object, senparcSetting)
RegisterService.Start(mockEnv.Object/*, senparcSetting*/)
.UseSenparcGlobal();
Assert.AreEqual(null, RedisManager.ConfigurationOption);// Not registered yet

Expand Down
Loading

0 comments on commit 77a93e2

Please sign in to comment.