BAIZE.Framework.Core 2.0.3

dotnet add package BAIZE.Framework.Core --version 2.0.3
                    
NuGet\Install-Package BAIZE.Framework.Core -Version 2.0.3
                    
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="BAIZE.Framework.Core" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BAIZE.Framework.Core" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="BAIZE.Framework.Core" />
                    
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 BAIZE.Framework.Core --version 2.0.3
                    
#r "nuget: BAIZE.Framework.Core, 2.0.3"
                    
#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 BAIZE.Framework.Core@2.0.3
                    
#: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=BAIZE.Framework.Core&version=2.0.3
                    
Install as a Cake Addin
#tool nuget:?package=BAIZE.Framework.Core&version=2.0.3
                    
Install as a Cake Tool

<div align="center">BAIZE.Framework.Core</div>

项目介绍

BAIZE.Framework.Core 是一套封装了项目常用组件的类库,适用于中小型企业的NetCore项目。

项目功能

  • SqlSugar - 集成数据库访问组件(支持多种数据库)
  • Serilog - 集成结构化日志组件(多输出、异步)
  • Redis - 集成分布式缓存组件(异步支持)
  • RabbitMQ - 集成消息队列组件(连接池、重试机制)
  • MQTT - 集成MQTT组件(托管客户端、事件驱动)
  • Helper - 完善的工具类库(JSON、序列化、日期、字符串、文件操作等)

优化改进

代码质量提升

  1. 修复文件名错误MD5Hepler.csMD5Helper.cs
  2. 清理冗余代码:移除 RabbitMQService.cs 中被注释的旧代码
  3. 升级 JSON 库:从 DataContractJsonSerializer 升级到 System.Text.Json

功能增强

  1. JsonHelper

    • 支持灵活的序列化选项
    • 增加 DeserializeAsync 异步方法
    • 添加 IsValidJson 验证方法
  2. SerializeHelper

    • 使用 System.Text.Json
    • 支持 Base64 序列化
    • 添加深度复制功能
    • 支持自定义选项
  3. StringHelper

    • 添加多种字符串处理方法
    • 支持命名格式转换(驼峰、帕斯卡、下划线)
    • 增加正则表达式支持
    • 添加验证方法(邮箱、手机号、身份证)
  4. FileHelper

    • 使用 using 语句确保资源释放
    • 异步操作支持
    • 添加安全删除功能
    • 增加文件信息获取方法
  5. DateHelper

    • 增加更多日期操作方法
    • 支持时间戳转换
    • 添加日期判断方法
  6. ConsoleHelper

    • 丰富控制台输出功能
    • 添加进度条显示
    • 支持密码输入
    • 增加确认输入方法

后续内容

  • 持续开发中

配置appsetting.json

 "Database": {
    // DbType取值范围:[ "MySql", "SqlServer", "Sqlite", "Oracle", "PostgreSql"]   
    "ConfigId": 0,
    "DataBaseType": "xxxx",
    "ConnectionString": "xxxx",
    "IsAutoCloseConnection": true   
  },
  "MqttClient": {
    "Server": "xxx.xxx.xxx.xxx",
    "Port": xxxx,
    "ClientId": "xxxx",
    "Username": "xxxx",
    "Password": "xxxx",
    "UseTls": false,
    "KeepAliveInterval": 15,
    "ReconnectDelay": 5,
    "CleanSession": true,
    "ConnectionTimeout": 10,
    "MaxPendingMessages": 100,
    "QosLevel": 1,
    "AutoReconnect": true   
  },
  "Redis": {
    "Server": "xxx.xxx.xxx.xxx",
    "Port": xxxx,
    "Password": "xxxx",
    "Database": 1
  },
  "RabbitMQ": {
    "HostName": "xxx.xxx.xxx.xxx",
    "Port": xxxx,
    "VirtualHost": "x",
    "UserName": "xxxx",
    "Password": "xxxx",
    "ClientProvidedName": "Broker",
    "RequestedHeartbeat": 60,
    "AutomaticRecoveryEnabled": true,
    "NetworkRecoveryInterval": "00:00:10",
    "ContinuationTimeout": "00:00:20",
    "HandshakeContinuationTimeout": "00:00:10",
    "DefaultQueue": "default.queue",
    "DefaultExchange": "default.exchange",
    "DefaultRoutingKey": "default.routing.key",
    "DurableQueue": true,
    "ExclusiveQueue": false,
    "AutoDeleteQueue": false,
    "AutoAcknowledge": false,
    "PrefetchCount": 10,
    "ConnectionPoolSize": 5,
    "MaxChannelPerConnection": 50,
    "MaxRetryCount": 3,
    "RetryDelay": "00:00:05",
    "EnableMetrics": true,
    "MetricsInterval": "00:05:00"
  },
  "Seq": {
    "minimumLevel": "Information",
    "application": "xxxxx",
    "apiKey": "xxxx",
    "serverUrl": "http://xxx.xxx:xxxx"
  }

快速开始


// 添加Serilog
builder.Services.AddSerilogSetup(builder.Configuration);
// SqlSugar服务
builder.Services.AddSqlSugarSetup(builder.Configuration);
//注册RabbitMQ服务
builder.Services.AddRabbitMQSetup(builder.Configuration);
//注册MQTT服务
builder.Services.AddMqttClientSetup(builder.Configuration);
//注册Redis服务
builder.Services.AddRedisClientSetup(builder.Configuration);

  • 数据库访问注入 ISqlSugarClient db
  • 缓存注入 IRedisService redis
  • 消息队列注入 IRabbitMQService rabbitMQ
  • MQTT注入 IMqttClientService mqttClient
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.3 97 4/13/2026
2.0.2 138 1/5/2026
2.0.1 115 1/5/2026
1.0.1 207 10/14/2025