XY.CO2NET 2.0.8

There is a newer version of this package available.
See the version list below for details.
dotnet add package XY.CO2NET --version 2.0.8
                    
NuGet\Install-Package XY.CO2NET -Version 2.0.8
                    
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.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XY.CO2NET" Version="2.0.8" />
                    
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.8
                    
#r "nuget: XY.CO2NET, 2.0.8"
                    
#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.8
                    
#: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.8
                    
Install as a Cake Addin
#tool nuget:?package=XY.CO2NET&version=2.0.8
                    
Install as a Cake Tool

XY.CO2NET

GitHub stars GitHub forks GitHub issues GitHub license

项目说明

XY.CO2NET 是一个多项目基础能力集合仓库,覆盖缓存、短信、OCR、AI 结构化提取与 ASP.NET Core MVC 扩展能力。

当前主要类库包括:

  • XY.CO2NET:通用基础类库(缓存、加密、HTTP、线程等)
  • XY.CO2NET.Cache.Redis:Redis 缓存扩展
  • XY.SMS:短信服务封装(阿里云)
  • XY.OCR.AlibabaCloud:阿里云 OCR 服务封装
  • XY.OCR.UmiOCR:UmiOCR 服务封装
  • XY.AI.SemanticKernel:基于 Semantic Kernel 的 AI 结构化数据提取
  • XY.AspNetCore.Mvc.Validation:ASP.NET Core MVC 参数验证扩展

目标框架

仓库内项目按功能分别支持以下框架组合:

  • NET48
  • netstandard2.0
  • net6.0
  • net10.0

NuGet 包发布说明(更新)

  • 多项目已统一补充 PackageIconPackageReadmeFile、License 与仓库元数据
  • 包图标统一复用 XY.OCR.AlibabaCloud/icon.png
  • 部分项目启用了 Central Package Management(Directory.Packages.props

如遇 CI 还原失败(NU1100)请检查仓库根目录 NuGet.ConfigpackageSourceMapping 是否覆盖所用包前缀。

本地缓存使用

缓存注册(不注册默认使用本地缓存)
//注册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.7 -m "Release v2.0.7" 
git push origin refs/tags/v2.0.7

删除本地标签

git tag -d v2.0.0

删除远程标签

git push origin --delete v2.0.0
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 120 5/5/2026
2.0.8 170 4/27/2026
2.0.7 168 4/25/2026
2.0.6 164 4/23/2026
2.0.5 168 4/22/2026
2.0.3 173 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 255 9/30/2025
1.1.0 278 9/26/2025
1.0.9 572 11/18/2022
1.0.8 504 11/12/2022
1.0.7 572 9/2/2022
1.0.6 627 6/2/2022
1.0.5 620 6/2/2022
1.0.4 648 3/3/2022
1.0.2 930 1/11/2022
Loading failed

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