登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
AI 队友
登录
注册
轻量养虾,开箱即用!低 Token + 稳定算力,Gitee & 模力方舟联合出品的 PocketClaw 正式开售!点击了解详情
代码拉取完成,页面将自动刷新
开源项目
>
WEB应用开发
>
Web开发框架
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
9.9K
Star
14.5K
Fork
4.2K
GVP
dotNET China
/
Furion
代码
Issues
1
Pull Requests
0
统计
流水线
服务
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
开发画像分析
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
📝 发布 Furion v4.8.7 版本
已完成
#I6GVN8
百小僧
拥有者
创建于
2023-02-22 12:11
## 版本说明 发布 `Furion` 和 `Furion.Tools` 和 `Furion.Xunit` `v4.8.7` 版本,适配 `.NET8 Preview.1`。 https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-1/ ## 本期更新 - **新特性** - [新增] 定时任务看板支持自定义刷新频率 `SyncRate` 功能 <sup>4.8.7.43</sup> <sup>⏱️2023.04.12</sup> [703b465](https://gitee.com/dotnetchina/Furion/commit/703b465f41510d86976d325cd31d7f8eba3a31ec) - [新增] `Serve.GetIdleHost([host])` 静态方法,可获取一个指定主机的 `Web` 地址(端口) <sup>4.8.7.43</sup> <sup>⏱️2023.04.12</sup> [fdf788](https://gitee.com/dotnetchina/Furion/commit/fdf7885f282057599be6b1b3833373dd153db42a) - [新增] **粘土对象可配置访问不存在 `Key` 时是抛异常还是返回 `null`** <sup>4.8.7.40</sup> <sup>⏱️2023.04.10</sup> [e994d53](https://gitee.com/dotnetchina/Furion/commit/e994d53b64a825461673f48960df1716be44f192) - [新增] 定时任务看板支持完全自定义 `RequestPath` 入口地址功能 <sup>4.8.7.34</sup> <sup>⏱️2023.04.04</sup> [24736f6](https://gitee.com/dotnetchina/Furion/commit/24736f6421dd5aa90289fbb9bc519e6ef55e667f) - [新增] `App.GetServices(type)` 和 `App.GetServices<T>()` 获取服务实例集合 <sup>4.8.7.33</sup> <sup>⏱️2023.04.03</sup> [c3e9957](https://gitee.com/dotnetchina/Furion/commit/c3e9957fd276920b3a8366eda3e347500334458e) - [新增] 远程请求 `[HttpMethod]ToSaveAsync` 下载远程文件并保存到磁盘方法 <sup>4.8.7.32</sup> <sup>⏱️2023.04.02</sup> [bfd02c1](https://gitee.com/dotnetchina/Furion/commit/bfd02c1a2ce4229e90fc825fe5657ada59e1892f) - [新增] **定时任务一系列 `.AlterTo` 修改作业触发器触发时间便捷方法** <sup>4.8.7.31</sup> <sup>⏱️2023.03.31</sup> [0349017](https://gitee.com/dotnetchina/Furion/commit/0349017902835bed91041fb3ea1ee987b0a81bbb) - [新增] 多语言支持 `DateTime` 时间格式化配置节点 `DateTimeFormatCulture` <sup>4.8.7.31</sup> <sup>⏱️2023.03.31</sup> [#I6RUOU](https://gitee.com/dotnetchina/Furion/issues/I6RUOU) - [新增] `Serve.IdleHost` 静态属性,可获取一个随机空闲 `Web` 主机地址(端口) <sup>4.8.7.29</sup> <sup>⏱️2023.03.30</sup> [e425063](https://gitee.com/dotnetchina/Furion/commit/e4250634246af612f052ec935416ee050b44d22e) - [新增] `WinForm/WPF` 静态方法 `Serve.RunNative()` 可配置是否启用 `Web` 主机功能 <sup>4.8.7.26</sup> <sup>⏱️2023.03.29</sup> [#I6R97L](https://gitee.com/dotnetchina/Furion/issues/I6R97L) - [新增] **`WinForm/WPF` 支持依赖注入的 `Native.CreateInstance<T>()` 静态方法** <sup>4.8.7.23</sup> <sup>⏱️2023.03.27</sup> [53d51c3](https://gitee.com/dotnetchina/Furion/commit/53d51c3645f4066f5d68d4726d78e389fd544560) - [新增] **`WinForm/WPF` 快速注册静态方法:`Serve.RunNative()`** <sup>4.8.7.23</sup> <sup>⏱️2023.03.27</sup> [53d51c3](https://gitee.com/dotnetchina/Furion/commit/53d51c3645f4066f5d68d4726d78e389fd544560) - [新增] 远程请求支持 `Content-Type` 为 `text/html` 和 `text/plain` 处理 <sup>4.8.7.22</sup> <sup>⏱️2023.03.27</sup> [#I6QMLR](https://gitee.com/dotnetchina/Furion/issues/I6QMLR) - [新增] **粘土对象可转换成 `IEnumerable<T>` 对象并实现 `Lambda/Linq` 操作** <sup>4.8.7.19</sup> <sup>⏱️2023.03.22</sup> [2b14ed9](https://gitee.com/dotnetchina/Furion/commit/2b14ed9da03699619b1fade6e053f65b77a5b0fe) - [新增] `Crontab.IsValid(...)` 静态方法,判断 `Cron` 表达式是否有效 <sup>4.8.7.17</sup> <sup>⏱️2023.03.20</sup> [#I6OHO4](https://gitee.com/dotnetchina/Furion/issues/I6OHO4) - [新增] **日志配置 `WithStackFrame`,可控制是否输出产生日志的程序集,类型和具体方法** <sup>4.8.7.16</sup> <sup>⏱️2023.03.19</sup> [5ad6ae2](https://gitee.com/dotnetchina/Furion/commit/5ad6ae241d1798ad788e42569a15d68686db4fa1) - [新增] 定时任务看板 `UI` 作业列表 `最近执行时间` 列和优化显示效果 <sup>4.8.7.12</sup> <sup>⏱️2023.03.15</sup> [26462a8](https://gitee.com/dotnetchina/Furion/commit/26462a84e553e39ce4cddd5128833ff732c85f3e) [cb5dd17](https://gitee.com/dotnetchina/Furion/commit/cb5dd17969244987b847fcd96825d28b243a5b9f) - [新增] 定时任务作业计划/工厂立即执行 `RunJob` 方法 <sup>4.8.7.11</sup> <sup>⏱️2023.03.15</sup> [#I6LD9X](https://gitee.com/dotnetchina/Furion/issues/I6LD9X) - [新增] 定时任务看板 `UI` 提供立即执行功能 <sup>4.8.7.11</sup> <sup>⏱️2023.03.15</sup> [#I6LD9X](https://gitee.com/dotnetchina/Furion/issues/I6LD9X) - [新增] 远程请求 `HttpRequestMessage` 拓展方法 `AppendHeaders` <sup>4.8.7.10</sup> <sup>⏱️2023.03.14</sup> [#I6MVHT](https://gitee.com/dotnetchina/Furion/issues/I6MVHT) - [新增] 定时任务作业执行上下文 `JobExecutionContext` 服务提供器 `ServiceProvider` 属性 <sup>4.8.7.10</sup> <sup>⏱️2023.03.14</sup> [02586f8](https://gitee.com/dotnetchina/Furion/commit/02586f83edb4f98e4801ae65080c2d6aa5545763) - [新增] **定时任务 `HTTP` 作业,支持定时请求互联网 `URL` 地址** <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [新增] **定时任务作业触发器 `Trigger` 执行结果 `Result` 和执行耗时 `ElapsedTime` 属性** <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [新增] **定时任务作业看板支持查看作业触发器执行结果 `Result` 和执行耗时 `ElapsedTime` 属性** <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [新增] 定时任务休眠时长和唤醒时机日志输出 <sup>4.8.7.6</sup> <sup>⏱️2023.03.08</sup> [#I6LANE](https://gitee.com/dotnetchina/Furion/issues/I6LANE) - [新增] **`Sql` 高级拦截支持返回 `IEnumerable<T>` 和 `T[]` 类型值** <sup>4.8.7.5</sup> <sup>⏱️2023.03.07</sup> [f2ca2d3](https://gitee.com/dotnetchina/Furion/commit/f2ca2d303ea06febcc3a50df56ed03895e43c639) - [新增] `.m3u8` 和 `.ts` 文件类型 `MIME` 支持 <sup>4.8.7.5</sup> <sup>⏱️2023.03.07</sup> [#I6KKEM](https://gitee.com/dotnetchina/Furion/issues/I6KKEM) - [新增] 审计日志 `LoggingMonitor` 支持对参数贴 `[SuppressMonitor]` 特性跳过记录 <sup>4.8.7.3</sup> <sup>⏱️2023.03.01</sup> [#I6IVGW](https://gitee.com/dotnetchina/Furion/issues/I6IVGW) - [新增] 审计日志 `LoggingMonitor` 监听 `TraceId`、`ThreadId`、`Accept-Language` <sup>4.8.7.1</sup> <sup>⏱️2023.02.27</sup> [df35201](https://gitee.com/dotnetchina/Furion/commit/df35201622f4d908ab423baff27caef856a23527) - [新增] 规范化结果 `UnifyContext.GetSerializerSettings(string)` 静态方法 <sup>4.8.7.1</sup> <sup>⏱️2023.02.27</sup> [#I6HM7T](https://gitee.com/dotnetchina/Furion/issues/I6HM7T) - **突破性变化** - [调整] **定时任务动态作业 `DynamicJob` 委托/方法签名** <sup>4.8.7.10</sup> <sup>⏱️2023.03.14</sup> [6d56b53](https://gitee.com/dotnetchina/Furion/commit/6d56b531f34c9d616202a6f53c31a10974065d56) - [升级] **适配 `.NET8 Preview.1`** <sup>4.8.7</sup> <sup>⏱️2023.02.22</sup> - [升级] **脚手架支持创建 `.NET8 Preview.1` 项目** <sup>4.8.7</sup> <sup>⏱️2023.02.22</sup> - **问题修复** - [修复] 远程请求获取 `Cookies` 时如果包含相同 `Key` 异常问题 <sup>4.8.7.44</sup> <sup>⏱️2023.04.12</sup> [#I6V3T7](https://gitee.com/dotnetchina/Furion/issues/I6V3T7) - [修复] 粘土对象转换为 `Dictionary<string, object>` 类型异常 <sup>4.8.7.41</sup> <sup>⏱️2023.04.11</sup> [f96baeb](https://gitee.com/dotnetchina/Furion/commit/f96baebbb06b53fc481ea7925cbbfbcb191f9c10) - [修复] `TP.Wrapper` 静态类不能准确识别多行内容问题 <sup>4.8.7.40</sup> <sup>⏱️2023.04.10</sup> [#I6UAC8](https://gitee.com/dotnetchina/Furion/issues/I6UAC8) - [修复] 粘土对象不支持运行时动态设置携带特殊字符的 `Key` 键 <sup>4.8.7.39</sup> <sup>⏱️2023.04.10</sup> [6572515](https://gitee.com/dotnetchina/Furion/commit/6572515abbd93c4572cc513da4dd5aa497d144d2) - [修复] 视图引擎模型为匿名泛型集合类型时出现类型转换异常 <sup>4.8.7.38</sup> <sup>⏱️2023.04.07</sup> [!773](https://gitee.com/dotnetchina/Furion/pulls/773) - [修复] 定时任务通过作业 `Id` 删除作业不能删除作业触发器问题 <sup>4.8.7.35</sup> <sup>⏱️2023.04.05</sup> [312ca35](https://gitee.com/dotnetchina/Furion/commit/312ca357cca1e59e1b6cc67ec499bf512f79dd0a) - [修复] 动态 `WebAPI` 去除叠词类型命名如 `ServiceService` 前后缀异常问题 <sup>4.8.7.32</sup> <sup>⏱️2023.04.02</sup> [#I6SB3Z](https://gitee.com/dotnetchina/Furion/issues/I6SB3Z) - [修复] 因 `4.8.7.22` 版本导致动态 `WebAPI` 类型注释丢失问题 <sup>4.8.7.27</sup> <sup>⏱️2023.03.29</sup> [#I6QM23](https://gitee.com/dotnetchina/Furion/issues/I6QM23) - [修复] 粘土对象遍历对象键值对因 `4.8.7.19` 版本更新导致异常 <sup>4.8.7.25</sup> <sup>⏱️2023.03.28</sup> [#I6R4ZU](https://gitee.com/dotnetchina/Furion/issues/I6R4ZU) - [修复] `Swagger UI` 不显示 `ControllerBase` 派生类注释 <sup>4.8.7.22</sup> <sup>⏱️2023.03.27</sup> [#I6QM23](https://gitee.com/dotnetchina/Furion/issues/I6QM23) - [修复] 日志输出 `JSON` 格式漏掉了 `UseUtcTimestamp` 和 `TraceId` 键值 <sup>4.8.7.21</sup> <sup>⏱️2023.03.27</sup> [5c90e65](https://gitee.com/dotnetchina/Furion/commit/5c90e652b20dc36450ea0322fe6d22cd2a39d5e6) - [修复] 启用规范化结果后导致 `WebSocket` 连接断开时出现异常 <sup>4.8.7.20</sup> <sup>⏱️2023.03.23</sup> [#I6PI5E](https://gitee.com/dotnetchina/Furion/issues/I6PI5E) - [修复] 定时任务作业状态为 `积压:0` 和 `归档:6` 时调用立即执行后不能恢复上一次状态 <sup>4.8.7.18</sup> <sup>⏱️2023.03.21</sup> [6f5aae8](https://gitee.com/dotnetchina/Furion/commit/6f5aae8dd1169b7111ff6801111691764b03ba29) - [修复] 使用达梦数据库执行 `sql` 不能自动修复命令参数前缀 <sup>4.8.7.18</sup> <sup>⏱️2023.03.21</sup> [#I6OK4T](https://gitee.com/dotnetchina/Furion/issues/I6OK4T) - [修复] `Cron` 表达式 `*` 符号解析器不够严谨,如:`*1111aaaaa` 也被解析为 `*` <sup>4.8.7.17</sup> <sup>⏱️2023.03.20</sup> [#I6OHO4](https://gitee.com/dotnetchina/Furion/issues/I6OHO4) - [修复] 定时任务更新作业 `null` 值默认被跳过问题 <sup>4.8.7.17</sup> <sup>⏱️2023.03.20</sup> [#I6OHO4](https://gitee.com/dotnetchina/Furion/issues/I6OHO4) - [修复] 视图引擎不支持强制转换的 `(object)model` 类型 <sup>4.8.7.16</sup> <sup>⏱️2023.03.19</sup> [#I6O3BD](https://gitee.com/dotnetchina/Furion/issues/I6O3BD) - [修复] 启用请求 `Body` 重复读且在授权之前读取导致非 `GET/HEAD/OPTION` 请求异常 <sup>4.8.7.15</sup> <sup>⏱️2023.03.19</sup> [#I6NX9E](https://gitee.com/dotnetchina/Furion/issues/I6NX9E) - [修复] 定时任务生成 `SQL` 语句没有处理 `'` 转义问题 <sup>4.8.7.15</sup> <sup>⏱️2023.03.19</sup> [#I6NXKA](https://gitee.com/dotnetchina/Furion/issues/I6NXKA) - [修复] 数据验证 `ValiationTypes.GUID_OR_UUID` 不支持大写问题 <sup>4.8.7.14</sup> <sup>⏱️2023.03.16</sup> [#I6NP22](https://gitee.com/dotnetchina/Furion/issues/I6NP22) - [修复] `Blazor` 脚手架出现 `blazor.server.js` 不能加载问题(`404`) <sup>4.8.7.13</sup> <sup>⏱️2023.03.16</sup> [#I6NOBQ](https://gitee.com/dotnetchina/Furion/issues/I6NOBQ) - [修复] 定时任务服务在停止进程时会卡住 `30秒` 问题 <sup>4.8.7.8</sup> <sup>⏱️2023.03.13</sup> [#I6MI9I](https://gitee.com/dotnetchina/Furion/issues/I6MI9I) [#I6MHOU](https://gitee.com/dotnetchina/Furion/issues/I6MHOU) - [修复] 定时任务看板删除不存在的作业触发器出现空异常 <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [修复] 日志消息没有处理 `\n` 换行符对齐问题 <sup>4.8.7.6</sup> <sup>⏱️2023.03.10</sup> [759bcc5](https://gitee.com/dotnetchina/Furion/commit/759bcc5dca09017f37a5be6ad2beefad33214fae) - [修复] 审计日志 `LoggingMonitor` 对特定参数贴有 `[FromServices]` 特性依旧记录问题 <sup>4.8.7.3</sup> <sup>⏱️2023.03.01</sup> [17b134e](https://gitee.com/dotnetchina/Furion/commit/17b134efd82baa31bff6a0e763f93839c767c364) - [修复] `Swagger` 接口排序同时指定 `Tag` 和 `Order` 之后无效 <sup>4.8.7.2</sup> <sup>⏱️2023.03.01</sup> [#I6IQDI](https://gitee.com/dotnetchina/Furion/issues/I6IQDI) [#I6IP66](https://gitee.com/dotnetchina/Furion/issues/I6IP66) - **其他更改** - [调整] `Blazor` + `WebAPI` 脚手架模板,默认添加授权支持 <sup>4.8.7.37</sup> <sup>⏱️2023.04.07</sup> [#I6OM8O](https://gitee.com/dotnetchina/Furion/issues/I6OM8O) [544f80d](https://gitee.com/dotnetchina/Furion/commit/544f80dbd7c800e28d9c4137e1c3bfc289c14177) - [调整] 定时任务动态委托作业持久化逻辑,采用不触发持久化操作 <sup>4.8.7.36</sup> <sup>⏱️2023.04.06</sup> [7bb58b6](https://gitee.com/dotnetchina/Furion/commit/7bb58b64407f899d5f7f128da64fa972cf4df61b) - [调整] 多语言中间件 `app.UseAppLocalization()` 添加 `Action<options>` 委托参数 <sup>4.8.7.30</sup> <sup>⏱️2023.03.31</sup> [#I6RUOU](https://gitee.com/dotnetchina/Furion/issues/I6RUOU) - [调整] 定时任务 `Http` 作业 `HttpMethod` 属性拼写错成 `HttpMedhod` <sup>4.8.7.24</sup> <sup>⏱️2023.03.28</sup> [!756](https://gitee.com/dotnetchina/Furion/pulls/756) - [调整] 粘土对象 `number` 类型处理,若含 `.` 转 `double` 类型,否则转 `long` 类型 <sup>4.8.7.24</sup> <sup>⏱️2023.03.28</sup> [e82e883](https://gitee.com/dotnetchina/Furion/commit/e82e883d54282b749390ae5e93df8c3e7acaa97e) - [调整] 视图引擎默认程序集,追加 `System.Collections` 程序集 <sup>4.8.7.16</sup> <sup>⏱️2023.03.18</sup> [#I6O3BD](https://gitee.com/dotnetchina/Furion/issues/I6O3BD) - [调整] 定时任务配置选项 `BuilSqlType` 属性命为 `BuildSqlType` <sup>4.8.7.11</sup> <sup>⏱️2023.03.15</sup> [92117b8](https://gitee.com/dotnetchina/Furion/commit/92117b842f7f8bdeb983bf3dac510f713d8410c2) - [调整] **定时任务查看作业触发器运行记录由保存 `10条` 改为 `5条`** <sup>4.8.7.7</sup> <sup>⏱️2023.03.07</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [调整] 脚手架模板,默认启用主流文件类型 `MIME` 支持 <sup>4.8.7.5</sup> <sup>⏱️2023.03.07</sup> [e35cdab](https://gitee.com/dotnetchina/Furion/commit/e35cdab592d1a00ff32b08c566c4ed5d6ddcff24) - [调整] 审计日志 `LoggingMonitor` 返回值泛型字符串显示格式 <sup>4.8.7.1</sup> <sup>⏱️2023.02.27</sup> [df35201](https://gitee.com/dotnetchina/Furion/commit/df35201622f4d908ab423baff27caef856a23527) - **文档** - [新增] **[发布桌面程序](https://furion.baiqian.ltd/docs/bs-to-cs) 文档** - [新增] **[Native](https://furion.baiqian.ltd/docs/global/native) 全局静态类文档** - [新增] **[ASP.NET 8 集成](https://furion.baiqian.ltd/docs/get-start-net8) 文档** - [新增] **[.NET7 升级 .NET8](https://furion.baiqian.ltd/docs/net7-to-net8) 文档** - [更新] 定时任务文档、中间件文档、规范化结果文档、动态 `WebAPI` 文档、日志记录文档、事件总线文档、虚拟文件系统文档、`Sql` 高级代理文档、数据库实体文档、任务队列文档、跨域文档、配置选项文档、安全授权、脚手架文档、粘土对象文档、多语言文档 - **贡献者** - 拉风的CC ([@LFDCC](https://gitee.com/LFDCC)) [!773](https://gitee.com/dotnetchina/Furion/pulls/773) - 吴伟烈 ([@wuweilie](https://gitee.com/wuweilie)) [!772](https://gitee.com/dotnetchina/Furion/pulls/772) - 缄默 ([@alianyone](https://gitee.com/alianyone)) [!765](https://gitee.com/dotnetchina/Furion/pulls/765) - 写意 ([@xjj_0906](https://gitee.com/xjj_0906)) [!756](https://gitee.com/dotnetchina/Furion/pulls/756) - lampon ([@lampon](https://gitee.com/lampon)) [!740](https://gitee.com/dotnetchina/Furion/pulls/740) - family520 ([@family520](https://gitee.com/family520)) [!739](https://gitee.com/dotnetchina/Furion/pulls/739) - kingling ([@kinglinglive](https://gitee.com/kinglinglive)) [!732](https://gitee.com/dotnetchina/Furion/pulls/732) [!729](https://gitee.com/dotnetchina/Furion/pulls/729) - ksmy ([@ksmy](https://gitee.com/ksmy)) [!731](https://gitee.com/dotnetchina/Furion/pulls/731) - handsome_by ([@handsomeboyyl](https://gitee.com/handsomeboyyl)) [!727](https://gitee.com/dotnetchina/Furion/pulls/727) --- ## 本期亮点 **1. `LoggingMonitor` 支持跳过特定参数记录** 在 `Furion 4.8.7.3+` 版本新增 `[SuppressMonitor]` 特性支持标记参数(支持类型,方法)不被记录,如: ```cs showLineNumbers {2} [LoggingMonitor] public string GetName([SuppressMonitor]SomeType type, int id) // type 参数将跳过记录 { return nameof(Furion); } ``` ----- **2. `Sql` 高级代理支持 `IEnumerable<T>` 、`T[]` 和 `Tuple<(IEnumerable<T>, T[], T, List<T>)` 混合返回值** ```cs public interface ISql : ISqlDispatchProxy { [SqlExecute("select * from person where id = @id")] Person GetPerson(int id); [SqlExecute("select * from person where id = @id")] Task<Person> GetPersonAsync(int id); // 异步 // ---------------------------------------- [SqlExecute("select * from person")] List<Person> GetPersons(); [SqlExecute("select * from person")] Task<List<Person>> GetPersonsAsync(); // 异步 // ---------------------------------------- [SqlExecute("select * from person")] Person[] GetPersons(); [SqlExecute("select * from person")] Task<Person[]> GetPersonsAsync(); // 异步 // ---------------------------------------- [SqlExecute("select * from person")] IEnumerable<Person> GetPersons2(); [SqlExecute("select * from person")] Task<IEnumerable<Person>> GetPersons2Async(); // 异步 // ---------------------------------------- // 更复杂的组合 [SqlExecute(@" select * from person where id = 1; select * from person; select * from person where id > 0; select * from person where id > 0; ")] (Person, List<Person>, Person[], IEnumerable<Person>) GetPersons(); // 更复杂的组合 [SqlExecute(@" select * from person where id = 1; select * from person; select * from person where id > 0; select * from person where id > 0; ")] Task<(Person, List<Person>, Person[], IEnumerable<Person>)> GetPersonsAsync(); // 异步 } ``` ----- **3. 定时任务支持 `Http` 作业** `HTTP` 请求作业通常用于定时请求/访问互联网地址。 ```cs showLineNumbers {3} services.AddSchedule(options => { options.AddHttpJob(request => { request.RequestUri = "https://www.chinadot.net"; request.HttpMedhod = HttpMethod.Get; // request.Body = "{}"; // 设置请求报文体 }, Triggers.PeriodSeconds(5)); }); ``` 作业执行日志如下: ```bash showLineNumbers {13-26} info: 2023-03-11 11:05:36.3616747 +08:00 星期六 L System.Logging.ScheduleService[0] #1 Schedule hosted service is running. info: 2023-03-11 11:05:36.3652411 +08:00 星期六 L System.Logging.ScheduleService[0] #1 Schedule hosted service is preloading... info: 2023-03-11 11:05:36.5172940 +08:00 星期六 L System.Logging.ScheduleService[0] #1 The <job1_trigger1> trigger for scheduler of <job1> successfully appended to the schedule. info: 2023-03-11 11:05:36.5189296 +08:00 星期六 L System.Logging.ScheduleService[0] #1 The scheduler of <job1> successfully appended to the schedule. warn: 2023-03-11 11:05:36.5347816 +08:00 星期六 L System.Logging.ScheduleService[0] #1 Schedule hosted service preload completed, and a total of <1> schedulers are appended. warn: 2023-03-11 11:05:41.5228138 +08:00 星期六 L System.Logging.ScheduleService[0] #15 Schedule hosted service will sleep <4970> milliseconds and be waked up at <2023-03-11 11:05:46.486>. info: 2023-03-11 11:05:41.5542865 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.LogicalHandler[100] #9 Start processing HTTP request GET https://www.chinadot.net/ info: 2023-03-11 11:05:41.5589056 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.ClientHandler[100] #9 Sending HTTP request GET https://www.chinadot.net/ info: 2023-03-11 11:05:44.1305461 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.ClientHandler[101] #8 Received HTTP response headers after 2566.7836ms - 200 info: 2023-03-11 11:05:44.1343977 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.LogicalHandler[101] #8 End processing HTTP request after 2584.2327ms - 200 info: 2023-03-11 11:05:48.6475959 +08:00 星期六 L System.Logging.ScheduleService[0] #4 Received HTTP response body with a length of <63639> output as follows - 200 <!DOCTYPE html><html><head> <title>dotNET China | 让 .NET 开发更简单,更通用,更流行</title> ...... </body></html> ``` ----- **4. 调整定时任务动态作业 `DynamicJob` 委托/方法签名** 为了统一动态作业和普通作业的 `ExecuteAsync` 方法签名,故做出调整。 由: ```cs showLineNumbers {1,3} options.AddJob((serviceProvider, context, stoppingToken) => { serviceProvider.GetLogger().LogInformation($"{context}"); return Task.CompletedTask; }, Triggers.PeriodSeconds(5)); ``` 调整为: ```cs showLineNumbers {1,3} options.AddJob((context, stoppingToken) => { context.ServiceProvider.GetLogger().LogInformation($"{context}"); return Task.CompletedTask; }, Triggers.PeriodSeconds(5)); ``` ----- **5. 远程请求 `HttpRequestMessage` 拓展方法 `AppendHeaders`** **如需动态设置,可使用以下方式(添加参数拦截拦截器):** ```cs showLineNumbers {5} public interface IHttp : IHttpDispatchProxy { // 通过参数拦截 [Post("https://furion.baiqian.ltd/post")] Task<HttpResponseMessage> PostXXXAsync(string name, [Interceptor(InterceptorTypes.Request)] Action<HttpClient, HttpRequestMessage> action = default); } ``` 调用: ```cs showLineNumbers {1,3,9,15} _http.PostXXXAsync("百小僧", (client, requestMessage) => { requestMessage.AppendHeaders(new Dictionary<string , object> { { "Authorization", "Bearer 你的token"}, { "X-Authorization", "Bearer 你的刷新token"} }); // 也支持对象,匿名方式 requestMessage.AppendHeaders(new { Authorization = "Bearer 你的token", Others = "其他" }); // 也可以使用原生 requestMessage.Headers.TryAddWithoutValidation("Authorization", "Bearer 你的token"); requestMessage.Headers.TryAddWithoutValidation("key", "value"); }); ``` ----- **6. 定时任务立即执行方法** ```cs {showLineNumbers} // 带返回值 var scheduleResult = _schedulerFactory.TryRunJob("job1"); // 不带返回值 _schedulerFactory.RunJob("job1"); ``` ----- **7. 粘土对象可转换成 `IEnumerable<T>` 对象并实现 `Lambda/Linq` 操作** ```cs dynamic clay = Clay.Parse("{\"Foo\":\"json\",\"Bar\":100,\"Nest\":{\"Foobar\":true},\"Arr\":[\"NOR\",\"XOR\"]}"); // 将 clay.Arr 转换成 IEnumerable<dynamic> IEnumerable<dynamic> query = clay.Arr.AsEnumerator<dynamic>(); // 实现 Lambda/Linq 操作 var result = query.Where(u => u.StartsWith("N")) .Select(u => new { Name = u }) .ToList(); ``` ----- ## 文档更新  
## 版本说明 发布 `Furion` 和 `Furion.Tools` 和 `Furion.Xunit` `v4.8.7` 版本,适配 `.NET8 Preview.1`。 https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-preview-1/ ## 本期更新 - **新特性** - [新增] 定时任务看板支持自定义刷新频率 `SyncRate` 功能 <sup>4.8.7.43</sup> <sup>⏱️2023.04.12</sup> [703b465](https://gitee.com/dotnetchina/Furion/commit/703b465f41510d86976d325cd31d7f8eba3a31ec) - [新增] `Serve.GetIdleHost([host])` 静态方法,可获取一个指定主机的 `Web` 地址(端口) <sup>4.8.7.43</sup> <sup>⏱️2023.04.12</sup> [fdf788](https://gitee.com/dotnetchina/Furion/commit/fdf7885f282057599be6b1b3833373dd153db42a) - [新增] **粘土对象可配置访问不存在 `Key` 时是抛异常还是返回 `null`** <sup>4.8.7.40</sup> <sup>⏱️2023.04.10</sup> [e994d53](https://gitee.com/dotnetchina/Furion/commit/e994d53b64a825461673f48960df1716be44f192) - [新增] 定时任务看板支持完全自定义 `RequestPath` 入口地址功能 <sup>4.8.7.34</sup> <sup>⏱️2023.04.04</sup> [24736f6](https://gitee.com/dotnetchina/Furion/commit/24736f6421dd5aa90289fbb9bc519e6ef55e667f) - [新增] `App.GetServices(type)` 和 `App.GetServices<T>()` 获取服务实例集合 <sup>4.8.7.33</sup> <sup>⏱️2023.04.03</sup> [c3e9957](https://gitee.com/dotnetchina/Furion/commit/c3e9957fd276920b3a8366eda3e347500334458e) - [新增] 远程请求 `[HttpMethod]ToSaveAsync` 下载远程文件并保存到磁盘方法 <sup>4.8.7.32</sup> <sup>⏱️2023.04.02</sup> [bfd02c1](https://gitee.com/dotnetchina/Furion/commit/bfd02c1a2ce4229e90fc825fe5657ada59e1892f) - [新增] **定时任务一系列 `.AlterTo` 修改作业触发器触发时间便捷方法** <sup>4.8.7.31</sup> <sup>⏱️2023.03.31</sup> [0349017](https://gitee.com/dotnetchina/Furion/commit/0349017902835bed91041fb3ea1ee987b0a81bbb) - [新增] 多语言支持 `DateTime` 时间格式化配置节点 `DateTimeFormatCulture` <sup>4.8.7.31</sup> <sup>⏱️2023.03.31</sup> [#I6RUOU](https://gitee.com/dotnetchina/Furion/issues/I6RUOU) - [新增] `Serve.IdleHost` 静态属性,可获取一个随机空闲 `Web` 主机地址(端口) <sup>4.8.7.29</sup> <sup>⏱️2023.03.30</sup> [e425063](https://gitee.com/dotnetchina/Furion/commit/e4250634246af612f052ec935416ee050b44d22e) - [新增] `WinForm/WPF` 静态方法 `Serve.RunNative()` 可配置是否启用 `Web` 主机功能 <sup>4.8.7.26</sup> <sup>⏱️2023.03.29</sup> [#I6R97L](https://gitee.com/dotnetchina/Furion/issues/I6R97L) - [新增] **`WinForm/WPF` 支持依赖注入的 `Native.CreateInstance<T>()` 静态方法** <sup>4.8.7.23</sup> <sup>⏱️2023.03.27</sup> [53d51c3](https://gitee.com/dotnetchina/Furion/commit/53d51c3645f4066f5d68d4726d78e389fd544560) - [新增] **`WinForm/WPF` 快速注册静态方法:`Serve.RunNative()`** <sup>4.8.7.23</sup> <sup>⏱️2023.03.27</sup> [53d51c3](https://gitee.com/dotnetchina/Furion/commit/53d51c3645f4066f5d68d4726d78e389fd544560) - [新增] 远程请求支持 `Content-Type` 为 `text/html` 和 `text/plain` 处理 <sup>4.8.7.22</sup> <sup>⏱️2023.03.27</sup> [#I6QMLR](https://gitee.com/dotnetchina/Furion/issues/I6QMLR) - [新增] **粘土对象可转换成 `IEnumerable<T>` 对象并实现 `Lambda/Linq` 操作** <sup>4.8.7.19</sup> <sup>⏱️2023.03.22</sup> [2b14ed9](https://gitee.com/dotnetchina/Furion/commit/2b14ed9da03699619b1fade6e053f65b77a5b0fe) - [新增] `Crontab.IsValid(...)` 静态方法,判断 `Cron` 表达式是否有效 <sup>4.8.7.17</sup> <sup>⏱️2023.03.20</sup> [#I6OHO4](https://gitee.com/dotnetchina/Furion/issues/I6OHO4) - [新增] **日志配置 `WithStackFrame`,可控制是否输出产生日志的程序集,类型和具体方法** <sup>4.8.7.16</sup> <sup>⏱️2023.03.19</sup> [5ad6ae2](https://gitee.com/dotnetchina/Furion/commit/5ad6ae241d1798ad788e42569a15d68686db4fa1) - [新增] 定时任务看板 `UI` 作业列表 `最近执行时间` 列和优化显示效果 <sup>4.8.7.12</sup> <sup>⏱️2023.03.15</sup> [26462a8](https://gitee.com/dotnetchina/Furion/commit/26462a84e553e39ce4cddd5128833ff732c85f3e) [cb5dd17](https://gitee.com/dotnetchina/Furion/commit/cb5dd17969244987b847fcd96825d28b243a5b9f) - [新增] 定时任务作业计划/工厂立即执行 `RunJob` 方法 <sup>4.8.7.11</sup> <sup>⏱️2023.03.15</sup> [#I6LD9X](https://gitee.com/dotnetchina/Furion/issues/I6LD9X) - [新增] 定时任务看板 `UI` 提供立即执行功能 <sup>4.8.7.11</sup> <sup>⏱️2023.03.15</sup> [#I6LD9X](https://gitee.com/dotnetchina/Furion/issues/I6LD9X) - [新增] 远程请求 `HttpRequestMessage` 拓展方法 `AppendHeaders` <sup>4.8.7.10</sup> <sup>⏱️2023.03.14</sup> [#I6MVHT](https://gitee.com/dotnetchina/Furion/issues/I6MVHT) - [新增] 定时任务作业执行上下文 `JobExecutionContext` 服务提供器 `ServiceProvider` 属性 <sup>4.8.7.10</sup> <sup>⏱️2023.03.14</sup> [02586f8](https://gitee.com/dotnetchina/Furion/commit/02586f83edb4f98e4801ae65080c2d6aa5545763) - [新增] **定时任务 `HTTP` 作业,支持定时请求互联网 `URL` 地址** <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [新增] **定时任务作业触发器 `Trigger` 执行结果 `Result` 和执行耗时 `ElapsedTime` 属性** <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [新增] **定时任务作业看板支持查看作业触发器执行结果 `Result` 和执行耗时 `ElapsedTime` 属性** <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [新增] 定时任务休眠时长和唤醒时机日志输出 <sup>4.8.7.6</sup> <sup>⏱️2023.03.08</sup> [#I6LANE](https://gitee.com/dotnetchina/Furion/issues/I6LANE) - [新增] **`Sql` 高级拦截支持返回 `IEnumerable<T>` 和 `T[]` 类型值** <sup>4.8.7.5</sup> <sup>⏱️2023.03.07</sup> [f2ca2d3](https://gitee.com/dotnetchina/Furion/commit/f2ca2d303ea06febcc3a50df56ed03895e43c639) - [新增] `.m3u8` 和 `.ts` 文件类型 `MIME` 支持 <sup>4.8.7.5</sup> <sup>⏱️2023.03.07</sup> [#I6KKEM](https://gitee.com/dotnetchina/Furion/issues/I6KKEM) - [新增] 审计日志 `LoggingMonitor` 支持对参数贴 `[SuppressMonitor]` 特性跳过记录 <sup>4.8.7.3</sup> <sup>⏱️2023.03.01</sup> [#I6IVGW](https://gitee.com/dotnetchina/Furion/issues/I6IVGW) - [新增] 审计日志 `LoggingMonitor` 监听 `TraceId`、`ThreadId`、`Accept-Language` <sup>4.8.7.1</sup> <sup>⏱️2023.02.27</sup> [df35201](https://gitee.com/dotnetchina/Furion/commit/df35201622f4d908ab423baff27caef856a23527) - [新增] 规范化结果 `UnifyContext.GetSerializerSettings(string)` 静态方法 <sup>4.8.7.1</sup> <sup>⏱️2023.02.27</sup> [#I6HM7T](https://gitee.com/dotnetchina/Furion/issues/I6HM7T) - **突破性变化** - [调整] **定时任务动态作业 `DynamicJob` 委托/方法签名** <sup>4.8.7.10</sup> <sup>⏱️2023.03.14</sup> [6d56b53](https://gitee.com/dotnetchina/Furion/commit/6d56b531f34c9d616202a6f53c31a10974065d56) - [升级] **适配 `.NET8 Preview.1`** <sup>4.8.7</sup> <sup>⏱️2023.02.22</sup> - [升级] **脚手架支持创建 `.NET8 Preview.1` 项目** <sup>4.8.7</sup> <sup>⏱️2023.02.22</sup> - **问题修复** - [修复] 远程请求获取 `Cookies` 时如果包含相同 `Key` 异常问题 <sup>4.8.7.44</sup> <sup>⏱️2023.04.12</sup> [#I6V3T7](https://gitee.com/dotnetchina/Furion/issues/I6V3T7) - [修复] 粘土对象转换为 `Dictionary<string, object>` 类型异常 <sup>4.8.7.41</sup> <sup>⏱️2023.04.11</sup> [f96baeb](https://gitee.com/dotnetchina/Furion/commit/f96baebbb06b53fc481ea7925cbbfbcb191f9c10) - [修复] `TP.Wrapper` 静态类不能准确识别多行内容问题 <sup>4.8.7.40</sup> <sup>⏱️2023.04.10</sup> [#I6UAC8](https://gitee.com/dotnetchina/Furion/issues/I6UAC8) - [修复] 粘土对象不支持运行时动态设置携带特殊字符的 `Key` 键 <sup>4.8.7.39</sup> <sup>⏱️2023.04.10</sup> [6572515](https://gitee.com/dotnetchina/Furion/commit/6572515abbd93c4572cc513da4dd5aa497d144d2) - [修复] 视图引擎模型为匿名泛型集合类型时出现类型转换异常 <sup>4.8.7.38</sup> <sup>⏱️2023.04.07</sup> [!773](https://gitee.com/dotnetchina/Furion/pulls/773) - [修复] 定时任务通过作业 `Id` 删除作业不能删除作业触发器问题 <sup>4.8.7.35</sup> <sup>⏱️2023.04.05</sup> [312ca35](https://gitee.com/dotnetchina/Furion/commit/312ca357cca1e59e1b6cc67ec499bf512f79dd0a) - [修复] 动态 `WebAPI` 去除叠词类型命名如 `ServiceService` 前后缀异常问题 <sup>4.8.7.32</sup> <sup>⏱️2023.04.02</sup> [#I6SB3Z](https://gitee.com/dotnetchina/Furion/issues/I6SB3Z) - [修复] 因 `4.8.7.22` 版本导致动态 `WebAPI` 类型注释丢失问题 <sup>4.8.7.27</sup> <sup>⏱️2023.03.29</sup> [#I6QM23](https://gitee.com/dotnetchina/Furion/issues/I6QM23) - [修复] 粘土对象遍历对象键值对因 `4.8.7.19` 版本更新导致异常 <sup>4.8.7.25</sup> <sup>⏱️2023.03.28</sup> [#I6R4ZU](https://gitee.com/dotnetchina/Furion/issues/I6R4ZU) - [修复] `Swagger UI` 不显示 `ControllerBase` 派生类注释 <sup>4.8.7.22</sup> <sup>⏱️2023.03.27</sup> [#I6QM23](https://gitee.com/dotnetchina/Furion/issues/I6QM23) - [修复] 日志输出 `JSON` 格式漏掉了 `UseUtcTimestamp` 和 `TraceId` 键值 <sup>4.8.7.21</sup> <sup>⏱️2023.03.27</sup> [5c90e65](https://gitee.com/dotnetchina/Furion/commit/5c90e652b20dc36450ea0322fe6d22cd2a39d5e6) - [修复] 启用规范化结果后导致 `WebSocket` 连接断开时出现异常 <sup>4.8.7.20</sup> <sup>⏱️2023.03.23</sup> [#I6PI5E](https://gitee.com/dotnetchina/Furion/issues/I6PI5E) - [修复] 定时任务作业状态为 `积压:0` 和 `归档:6` 时调用立即执行后不能恢复上一次状态 <sup>4.8.7.18</sup> <sup>⏱️2023.03.21</sup> [6f5aae8](https://gitee.com/dotnetchina/Furion/commit/6f5aae8dd1169b7111ff6801111691764b03ba29) - [修复] 使用达梦数据库执行 `sql` 不能自动修复命令参数前缀 <sup>4.8.7.18</sup> <sup>⏱️2023.03.21</sup> [#I6OK4T](https://gitee.com/dotnetchina/Furion/issues/I6OK4T) - [修复] `Cron` 表达式 `*` 符号解析器不够严谨,如:`*1111aaaaa` 也被解析为 `*` <sup>4.8.7.17</sup> <sup>⏱️2023.03.20</sup> [#I6OHO4](https://gitee.com/dotnetchina/Furion/issues/I6OHO4) - [修复] 定时任务更新作业 `null` 值默认被跳过问题 <sup>4.8.7.17</sup> <sup>⏱️2023.03.20</sup> [#I6OHO4](https://gitee.com/dotnetchina/Furion/issues/I6OHO4) - [修复] 视图引擎不支持强制转换的 `(object)model` 类型 <sup>4.8.7.16</sup> <sup>⏱️2023.03.19</sup> [#I6O3BD](https://gitee.com/dotnetchina/Furion/issues/I6O3BD) - [修复] 启用请求 `Body` 重复读且在授权之前读取导致非 `GET/HEAD/OPTION` 请求异常 <sup>4.8.7.15</sup> <sup>⏱️2023.03.19</sup> [#I6NX9E](https://gitee.com/dotnetchina/Furion/issues/I6NX9E) - [修复] 定时任务生成 `SQL` 语句没有处理 `'` 转义问题 <sup>4.8.7.15</sup> <sup>⏱️2023.03.19</sup> [#I6NXKA](https://gitee.com/dotnetchina/Furion/issues/I6NXKA) - [修复] 数据验证 `ValiationTypes.GUID_OR_UUID` 不支持大写问题 <sup>4.8.7.14</sup> <sup>⏱️2023.03.16</sup> [#I6NP22](https://gitee.com/dotnetchina/Furion/issues/I6NP22) - [修复] `Blazor` 脚手架出现 `blazor.server.js` 不能加载问题(`404`) <sup>4.8.7.13</sup> <sup>⏱️2023.03.16</sup> [#I6NOBQ](https://gitee.com/dotnetchina/Furion/issues/I6NOBQ) - [修复] 定时任务服务在停止进程时会卡住 `30秒` 问题 <sup>4.8.7.8</sup> <sup>⏱️2023.03.13</sup> [#I6MI9I](https://gitee.com/dotnetchina/Furion/issues/I6MI9I) [#I6MHOU](https://gitee.com/dotnetchina/Furion/issues/I6MHOU) - [修复] 定时任务看板删除不存在的作业触发器出现空异常 <sup>4.8.7.7</sup> <sup>⏱️2023.03.11</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [修复] 日志消息没有处理 `\n` 换行符对齐问题 <sup>4.8.7.6</sup> <sup>⏱️2023.03.10</sup> [759bcc5](https://gitee.com/dotnetchina/Furion/commit/759bcc5dca09017f37a5be6ad2beefad33214fae) - [修复] 审计日志 `LoggingMonitor` 对特定参数贴有 `[FromServices]` 特性依旧记录问题 <sup>4.8.7.3</sup> <sup>⏱️2023.03.01</sup> [17b134e](https://gitee.com/dotnetchina/Furion/commit/17b134efd82baa31bff6a0e763f93839c767c364) - [修复] `Swagger` 接口排序同时指定 `Tag` 和 `Order` 之后无效 <sup>4.8.7.2</sup> <sup>⏱️2023.03.01</sup> [#I6IQDI](https://gitee.com/dotnetchina/Furion/issues/I6IQDI) [#I6IP66](https://gitee.com/dotnetchina/Furion/issues/I6IP66) - **其他更改** - [调整] `Blazor` + `WebAPI` 脚手架模板,默认添加授权支持 <sup>4.8.7.37</sup> <sup>⏱️2023.04.07</sup> [#I6OM8O](https://gitee.com/dotnetchina/Furion/issues/I6OM8O) [544f80d](https://gitee.com/dotnetchina/Furion/commit/544f80dbd7c800e28d9c4137e1c3bfc289c14177) - [调整] 定时任务动态委托作业持久化逻辑,采用不触发持久化操作 <sup>4.8.7.36</sup> <sup>⏱️2023.04.06</sup> [7bb58b6](https://gitee.com/dotnetchina/Furion/commit/7bb58b64407f899d5f7f128da64fa972cf4df61b) - [调整] 多语言中间件 `app.UseAppLocalization()` 添加 `Action<options>` 委托参数 <sup>4.8.7.30</sup> <sup>⏱️2023.03.31</sup> [#I6RUOU](https://gitee.com/dotnetchina/Furion/issues/I6RUOU) - [调整] 定时任务 `Http` 作业 `HttpMethod` 属性拼写错成 `HttpMedhod` <sup>4.8.7.24</sup> <sup>⏱️2023.03.28</sup> [!756](https://gitee.com/dotnetchina/Furion/pulls/756) - [调整] 粘土对象 `number` 类型处理,若含 `.` 转 `double` 类型,否则转 `long` 类型 <sup>4.8.7.24</sup> <sup>⏱️2023.03.28</sup> [e82e883](https://gitee.com/dotnetchina/Furion/commit/e82e883d54282b749390ae5e93df8c3e7acaa97e) - [调整] 视图引擎默认程序集,追加 `System.Collections` 程序集 <sup>4.8.7.16</sup> <sup>⏱️2023.03.18</sup> [#I6O3BD](https://gitee.com/dotnetchina/Furion/issues/I6O3BD) - [调整] 定时任务配置选项 `BuilSqlType` 属性命为 `BuildSqlType` <sup>4.8.7.11</sup> <sup>⏱️2023.03.15</sup> [92117b8](https://gitee.com/dotnetchina/Furion/commit/92117b842f7f8bdeb983bf3dac510f713d8410c2) - [调整] **定时任务查看作业触发器运行记录由保存 `10条` 改为 `5条`** <sup>4.8.7.7</sup> <sup>⏱️2023.03.07</sup> [01d4466](https://gitee.com/dotnetchina/Furion/commit/01d446620c20e373f198195797896d8c96feeb15) - [调整] 脚手架模板,默认启用主流文件类型 `MIME` 支持 <sup>4.8.7.5</sup> <sup>⏱️2023.03.07</sup> [e35cdab](https://gitee.com/dotnetchina/Furion/commit/e35cdab592d1a00ff32b08c566c4ed5d6ddcff24) - [调整] 审计日志 `LoggingMonitor` 返回值泛型字符串显示格式 <sup>4.8.7.1</sup> <sup>⏱️2023.02.27</sup> [df35201](https://gitee.com/dotnetchina/Furion/commit/df35201622f4d908ab423baff27caef856a23527) - **文档** - [新增] **[发布桌面程序](https://furion.baiqian.ltd/docs/bs-to-cs) 文档** - [新增] **[Native](https://furion.baiqian.ltd/docs/global/native) 全局静态类文档** - [新增] **[ASP.NET 8 集成](https://furion.baiqian.ltd/docs/get-start-net8) 文档** - [新增] **[.NET7 升级 .NET8](https://furion.baiqian.ltd/docs/net7-to-net8) 文档** - [更新] 定时任务文档、中间件文档、规范化结果文档、动态 `WebAPI` 文档、日志记录文档、事件总线文档、虚拟文件系统文档、`Sql` 高级代理文档、数据库实体文档、任务队列文档、跨域文档、配置选项文档、安全授权、脚手架文档、粘土对象文档、多语言文档 - **贡献者** - 拉风的CC ([@LFDCC](https://gitee.com/LFDCC)) [!773](https://gitee.com/dotnetchina/Furion/pulls/773) - 吴伟烈 ([@wuweilie](https://gitee.com/wuweilie)) [!772](https://gitee.com/dotnetchina/Furion/pulls/772) - 缄默 ([@alianyone](https://gitee.com/alianyone)) [!765](https://gitee.com/dotnetchina/Furion/pulls/765) - 写意 ([@xjj_0906](https://gitee.com/xjj_0906)) [!756](https://gitee.com/dotnetchina/Furion/pulls/756) - lampon ([@lampon](https://gitee.com/lampon)) [!740](https://gitee.com/dotnetchina/Furion/pulls/740) - family520 ([@family520](https://gitee.com/family520)) [!739](https://gitee.com/dotnetchina/Furion/pulls/739) - kingling ([@kinglinglive](https://gitee.com/kinglinglive)) [!732](https://gitee.com/dotnetchina/Furion/pulls/732) [!729](https://gitee.com/dotnetchina/Furion/pulls/729) - ksmy ([@ksmy](https://gitee.com/ksmy)) [!731](https://gitee.com/dotnetchina/Furion/pulls/731) - handsome_by ([@handsomeboyyl](https://gitee.com/handsomeboyyl)) [!727](https://gitee.com/dotnetchina/Furion/pulls/727) --- ## 本期亮点 **1. `LoggingMonitor` 支持跳过特定参数记录** 在 `Furion 4.8.7.3+` 版本新增 `[SuppressMonitor]` 特性支持标记参数(支持类型,方法)不被记录,如: ```cs showLineNumbers {2} [LoggingMonitor] public string GetName([SuppressMonitor]SomeType type, int id) // type 参数将跳过记录 { return nameof(Furion); } ``` ----- **2. `Sql` 高级代理支持 `IEnumerable<T>` 、`T[]` 和 `Tuple<(IEnumerable<T>, T[], T, List<T>)` 混合返回值** ```cs public interface ISql : ISqlDispatchProxy { [SqlExecute("select * from person where id = @id")] Person GetPerson(int id); [SqlExecute("select * from person where id = @id")] Task<Person> GetPersonAsync(int id); // 异步 // ---------------------------------------- [SqlExecute("select * from person")] List<Person> GetPersons(); [SqlExecute("select * from person")] Task<List<Person>> GetPersonsAsync(); // 异步 // ---------------------------------------- [SqlExecute("select * from person")] Person[] GetPersons(); [SqlExecute("select * from person")] Task<Person[]> GetPersonsAsync(); // 异步 // ---------------------------------------- [SqlExecute("select * from person")] IEnumerable<Person> GetPersons2(); [SqlExecute("select * from person")] Task<IEnumerable<Person>> GetPersons2Async(); // 异步 // ---------------------------------------- // 更复杂的组合 [SqlExecute(@" select * from person where id = 1; select * from person; select * from person where id > 0; select * from person where id > 0; ")] (Person, List<Person>, Person[], IEnumerable<Person>) GetPersons(); // 更复杂的组合 [SqlExecute(@" select * from person where id = 1; select * from person; select * from person where id > 0; select * from person where id > 0; ")] Task<(Person, List<Person>, Person[], IEnumerable<Person>)> GetPersonsAsync(); // 异步 } ``` ----- **3. 定时任务支持 `Http` 作业** `HTTP` 请求作业通常用于定时请求/访问互联网地址。 ```cs showLineNumbers {3} services.AddSchedule(options => { options.AddHttpJob(request => { request.RequestUri = "https://www.chinadot.net"; request.HttpMedhod = HttpMethod.Get; // request.Body = "{}"; // 设置请求报文体 }, Triggers.PeriodSeconds(5)); }); ``` 作业执行日志如下: ```bash showLineNumbers {13-26} info: 2023-03-11 11:05:36.3616747 +08:00 星期六 L System.Logging.ScheduleService[0] #1 Schedule hosted service is running. info: 2023-03-11 11:05:36.3652411 +08:00 星期六 L System.Logging.ScheduleService[0] #1 Schedule hosted service is preloading... info: 2023-03-11 11:05:36.5172940 +08:00 星期六 L System.Logging.ScheduleService[0] #1 The <job1_trigger1> trigger for scheduler of <job1> successfully appended to the schedule. info: 2023-03-11 11:05:36.5189296 +08:00 星期六 L System.Logging.ScheduleService[0] #1 The scheduler of <job1> successfully appended to the schedule. warn: 2023-03-11 11:05:36.5347816 +08:00 星期六 L System.Logging.ScheduleService[0] #1 Schedule hosted service preload completed, and a total of <1> schedulers are appended. warn: 2023-03-11 11:05:41.5228138 +08:00 星期六 L System.Logging.ScheduleService[0] #15 Schedule hosted service will sleep <4970> milliseconds and be waked up at <2023-03-11 11:05:46.486>. info: 2023-03-11 11:05:41.5542865 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.LogicalHandler[100] #9 Start processing HTTP request GET https://www.chinadot.net/ info: 2023-03-11 11:05:41.5589056 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.ClientHandler[100] #9 Sending HTTP request GET https://www.chinadot.net/ info: 2023-03-11 11:05:44.1305461 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.ClientHandler[101] #8 Received HTTP response headers after 2566.7836ms - 200 info: 2023-03-11 11:05:44.1343977 +08:00 星期六 L System.Net.Http.HttpClient.HttpJob.LogicalHandler[101] #8 End processing HTTP request after 2584.2327ms - 200 info: 2023-03-11 11:05:48.6475959 +08:00 星期六 L System.Logging.ScheduleService[0] #4 Received HTTP response body with a length of <63639> output as follows - 200 <!DOCTYPE html><html><head> <title>dotNET China | 让 .NET 开发更简单,更通用,更流行</title> ...... </body></html> ``` ----- **4. 调整定时任务动态作业 `DynamicJob` 委托/方法签名** 为了统一动态作业和普通作业的 `ExecuteAsync` 方法签名,故做出调整。 由: ```cs showLineNumbers {1,3} options.AddJob((serviceProvider, context, stoppingToken) => { serviceProvider.GetLogger().LogInformation($"{context}"); return Task.CompletedTask; }, Triggers.PeriodSeconds(5)); ``` 调整为: ```cs showLineNumbers {1,3} options.AddJob((context, stoppingToken) => { context.ServiceProvider.GetLogger().LogInformation($"{context}"); return Task.CompletedTask; }, Triggers.PeriodSeconds(5)); ``` ----- **5. 远程请求 `HttpRequestMessage` 拓展方法 `AppendHeaders`** **如需动态设置,可使用以下方式(添加参数拦截拦截器):** ```cs showLineNumbers {5} public interface IHttp : IHttpDispatchProxy { // 通过参数拦截 [Post("https://furion.baiqian.ltd/post")] Task<HttpResponseMessage> PostXXXAsync(string name, [Interceptor(InterceptorTypes.Request)] Action<HttpClient, HttpRequestMessage> action = default); } ``` 调用: ```cs showLineNumbers {1,3,9,15} _http.PostXXXAsync("百小僧", (client, requestMessage) => { requestMessage.AppendHeaders(new Dictionary<string , object> { { "Authorization", "Bearer 你的token"}, { "X-Authorization", "Bearer 你的刷新token"} }); // 也支持对象,匿名方式 requestMessage.AppendHeaders(new { Authorization = "Bearer 你的token", Others = "其他" }); // 也可以使用原生 requestMessage.Headers.TryAddWithoutValidation("Authorization", "Bearer 你的token"); requestMessage.Headers.TryAddWithoutValidation("key", "value"); }); ``` ----- **6. 定时任务立即执行方法** ```cs {showLineNumbers} // 带返回值 var scheduleResult = _schedulerFactory.TryRunJob("job1"); // 不带返回值 _schedulerFactory.RunJob("job1"); ``` ----- **7. 粘土对象可转换成 `IEnumerable<T>` 对象并实现 `Lambda/Linq` 操作** ```cs dynamic clay = Clay.Parse("{\"Foo\":\"json\",\"Bar\":100,\"Nest\":{\"Foobar\":true},\"Arr\":[\"NOR\",\"XOR\"]}"); // 将 clay.Arr 转换成 IEnumerable<dynamic> IEnumerable<dynamic> query = clay.Arr.AsEnumerator<dynamic>(); // 实现 Lambda/Linq 操作 var result = query.Where(u => u.StartsWith("N")) .Select(u => new { Name = u }) .ToList(); ``` ----- ## 文档更新  
评论 (
14
)
登录
后才可以发表评论
状态
已完成
待办的
进行中
已完成
已关闭
负责人
未设置
百小僧
monksoul
负责人
协作者
+负责人
+协作者
标签
重大调整
文档
未设置
标签管理
里程碑
v4.8.7
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (
-
)
标签 (
-
)
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
参与者(4)
C#
1
https://gitee.com/dotnetchina/Furion.git
git@gitee.com:dotnetchina/Furion.git
dotnetchina
Furion
Furion
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册