XY.CO2NET 2.0.9

dotnet add package XY.CO2NET --version 2.0.9
                    
NuGet\Install-Package XY.CO2NET -Version 2.0.9
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XY.CO2NET" Version="2.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XY.CO2NET" Version="2.0.9" />
                    
Directory.Packages.props
<PackageReference Include="XY.CO2NET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XY.CO2NET --version 2.0.9
                    
#r "nuget: XY.CO2NET, 2.0.9"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XY.CO2NET@2.0.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XY.CO2NET&version=2.0.9
                    
Install as a Cake Addin
#tool nuget:?package=XY.CO2NET&version=2.0.9
                    
Install as a Cake Tool

XY.CO2NET(Core Library)

解决方案级说明已迁移至仓库根目录 README.md

本 README 聚焦 XY.CO2NET 基础类库本身的使用方式。

本地缓存使用

缓存注册(不注册默认使用本地缓存)
//注册Redis缓存
XY.CO2NET.Cache.Redis.Register.SetConfigurationOption('Cache_Redis_Configuration');
XY.CO2NET.Cache.Redis.Register.UseKeyValueRedisNow();
基本使用
var cache = CacheStrategyFactory.GetObjectCacheStrategyInstance();//获取缓存策略
cache.Set("key", Value);//设定值
cache.Get<T>("key");//获取值

方法缓存参考接口:public static T GetMethodCache<T>(string cacheKey, Func<T> func, int timeoutSeconds) where T : class


缓存锁的使用

using (await Cache.BeginCacheLockAsync("Key", "").ConfigureAwait(false))
{
}

XYMessageQueue消息队列使用

启动线程消费队列XYMessageQueue.OperateQueue();

XYMessageQueue messageQueue = new XYMessageQueue();
messageQueue.Add("key", () => action());

日志使用

XY.CO2NET.Trace.XYTrace.Log("MSG");
XY.CO2NET.Trace.XYTrace.XXXLog("MSG");

线程使用

可通过将需要运行的后台线程方法添加到静态属性ThreadUtility.AsynThreadCollection然后通过ThreadUtility.Register();启动

各项初始化配置

NET48模式下通过RegisterService.Start(XYSetting xySetting)注册

NET Core模式下通过RegisterService.Start(XYSetting xySetting)注册

Http处理

1.HttpClient 2.Get 3.Post

配置文件的注册


.NetCore下各项使用

  • 缓存在表数据查询中的应用

  • .NetCore下缓存应用,分布式缓存应用

推送标签并出发Nuget发布

cd 'D:\Project\GitHub\XY.CO2NET' 
git tag -a v2.0.8 -m "Release v2.0.8" 
git push origin refs/tags/v2.0.8

删除本地标签

git tag -d v2.0.0

删除远程标签

git push origin --delete v2.0.0

安全扫描(gitleaks)

仓库根目录已提供 .gitleaks.toml 配置文件。

  • 本地扫描:
gitleaks detect --source . --config .gitleaks.toml --redact --verbose

gitleaks detect --source . --config .gitleaks.toml --redact --verbose --report-format sarif --report-path .\gitleaks.sarif
  • CI 扫描(发现泄露时返回非 0):
gitleaks detect --source . --config .gitleaks.toml --redact --exit-code 1

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on XY.CO2NET:

Package Downloads
XY.SMS

短信发送能力类库,支持阿里云/AlibabaCloud 与 Welink 通道,并支持 DI 与日志扩展。

XY.CO2NET.Cache.Redis

基于 StackExchange.Redis 的缓存扩展类库。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.9 71 5/5/2026
2.0.8 170 4/27/2026
2.0.7 167 4/25/2026
2.0.6 164 4/23/2026
2.0.5 168 4/22/2026
2.0.3 172 4/21/2026
2.0.2 176 4/14/2026
2.0.1 189 4/13/2026
2.0.0 170 4/12/2026
1.1.1 254 9/30/2025
1.1.0 275 9/26/2025
1.0.9 571 11/18/2022
1.0.8 501 11/12/2022
1.0.7 572 9/2/2022
1.0.6 625 6/2/2022
1.0.5 618 6/2/2022
1.0.4 646 3/3/2022
1.0.2 930 1/11/2022
Loading failed

[新增] Added
     - 补充基础能力说明(缓存、加密、HTTP、线程与常用工具)。
     [优化] Improved
     - 统一 NuGet 元数据格式(Description/Tags/README/Icon/License/Repository)。
     [修复] Fixed
     - 修正发布说明与版本信息一致性,优化多目标框架展示。