摘要: 仓储(Respository)是对数据库访问的一个封装 解决方案新建Respository文件夹,新建类库Web.Core.IRepository,Web.Core.Repository 解决方案新建Services文件夹,新建类库Web.Core.IServices,Web.Core.Servic 阅读全文
posted @ 2024-07-02 21:53 乐 乐——1128 阅读(2) 评论(0) 推荐(0) 编辑
摘要: JWT是什么?校验逻辑?授权过程?这里就不过多的阐述了,直接上代码 在appsettings.json中配置jwt参数的值 SecretKey必须大于16个字符 1 { 2 "Logging": { 3 "LogLevel": { 4 "Default": "Information", 5 "Mic 阅读全文
posted @ 2024-07-02 20:43 乐 乐——1128 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 在.netcore webapi 项目中,我们会把配置信息同意放置在appsettings.json中,通过新建读取帮助类,更加简单的读取配置信息。 新建公共类库文件夹Common,新建公共类库Web.Core.Common 在Web.Core.Common类库下新建Helper文件夹,新建AppS 阅读全文
posted @ 2024-07-02 19:48 乐 乐——1128 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1 /// <summary> 2 /// appsettings.json操作类 3 /// </summary> 4 public class AppSettings 5 { 6 static IConfiguration Configuration { get; set; } 7 static 阅读全文
posted @ 2024-07-01 15:07 乐 乐——1128 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 方法一:使用Math.Round()函数 double number = 3.14159;double result = Math.Round(number, 2); // 四舍五入保留两位小数Console.WriteLine(result); // 输出: 3.14 方法二:使用Math.Flo 阅读全文
posted @ 2024-06-26 15:04 乐 乐——1128 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1 public class BaseController : ControllerBase 2 { 3 public static string TIME_FORMAT_FULL = "yyyy-MM-dd HH:mm:ss"; 4 5 /// <summary> 6 /// 返回成功封装 7 / 阅读全文
posted @ 2024-06-24 15:26 乐 乐——1128 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 1 public class ComputerHelper 2 { 3 /// <summary> 4 /// 内存使用情况 5 /// </summary> 6 /// <returns></returns> 7 public static MemoryMetrics GetComputerInf 阅读全文
posted @ 2024-06-24 15:17 乐 乐——1128 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1 /// <summary> 2 /// SQL条件拼接 3 /// </summary> 4 /// <param name="str"></param> 5 /// <param name="condition"></param> 6 /// <returns></returns> 7 pub 阅读全文
posted @ 2024-06-24 15:12 乐 乐——1128 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 public static partial class Extensions 2 { 3 #region 枚举成员转成dictionary类型 4 /// <summary> 5 /// 转成dictionary类型 6 /// </summary> 7 /// <param name="enu 阅读全文
posted @ 2024-06-24 15:06 乐 乐——1128 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1 public class FileUtil 2 { 3 /// <summary> 4 /// 按时间来创建文件夹 5 /// </summary> 6 /// <param name="path"></param> 7 /// <returns>eg: /{yourPath}/2020/11/ 阅读全文
posted @ 2024-06-24 15:01 乐 乐——1128 阅读(1) 评论(0) 推荐(0) 编辑