摘要: 1、建立.Net Core Web Api 项目 2、新建相关类库项目 3、在EFCORE 项目中,创建DbContext 上下文实例,并将所有的实体类写入DbSet,在Program.cs 中注入创建的DbContext 实力及配置数据库链接信息 4、封装DbContext 仓储类 Reposit 阅读全文
posted @ 2024-07-02 14:15 liaer 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1、建立.Net Core Web Api 项目 2、新建类库,分类结构层 3、使用EF CORE 链接数据库,关联实体创建表,添加以下Nuget包 创建DbContext 实例 4、appsettings.json 配置数据库链接字符串,我当前是链接的mysql 数据库 5、Program 依赖关 阅读全文
posted @ 2024-07-02 14:14 liaer 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1、添加自定义日志过滤器类 using Serilog;using Microsoft.AspNetCore.Mvc.Filters; namespace ADTO.CMS.Common.Filter{ /// <summary> /// 日志记录过滤器 /// </summary> public 阅读全文
posted @ 2024-05-07 16:04 liaer 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 如果EFcore报错efcore This MySqlConnection is already in use,的话说明EFcore还在连接数据库,没有断开,然后你又再次连接到数据库。 注意观察,把数据库连接执行关闭操作就行了,例如Tolist()这样的操作 阅读全文
posted @ 2024-03-28 11:25 liaer 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1、获取属性 // 遍历 ChangeSystemSettingDto 的所有属性 foreach (var propertyInfo in typeof(ChangeSystemSettingDto).GetProperties()) { // 获取属性名称和值 var propertyName 阅读全文
posted @ 2023-05-24 16:35 liaer 阅读(40) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 批量修改系统设置 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task ChangeSystemSetting(ChangeSystemS 阅读全文
posted @ 2023-05-24 16:24 liaer 阅读(60) 评论(0) 推荐(0) 编辑
摘要: //物理删除(批量) //await this.Repository.GetAll().Where(p => input.Ids.Contains(p.Id)).BatchDeleteAsync(); //逻辑删除,批量修改删除字段 await this.Repository.GetAll().Wh 阅读全文
posted @ 2023-05-06 11:41 liaer 阅读(140) 评论(0) 推荐(0) 编辑
摘要: DECLARE @TableName sysname = 'tb_Customer';DECLARE @Result VARCHAR(MAX) = 'public class ' + @TableName + '{';SELECT @Result = @Result + ' /// <summary 阅读全文
posted @ 2023-04-06 13:36 liaer 阅读(64) 评论(0) 推荐(0) 编辑
摘要: var t = (from f in this.Repository.GetAll() join a in ( from re in _flowInfoRelationRoleRepository.GetAll() join rl in _userRolesRepository.GetAll() o 阅读全文
posted @ 2023-03-30 10:47 liaer 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 修改applicationhost.config 文件夹,增加一条电脑IP 访问地址(记得IP 需要更换为自己电脑IP,端口和localhost 相同) <bindings> <binding protocol="http" bindingInformation="*:44375:172.16.12 阅读全文
posted @ 2023-03-10 11:29 liaer 阅读(417) 评论(0) 推荐(0) 编辑