...

 

1、Controller中的形参命名为query、pager,且里面实体中的参数也有Query、Pager参数时,Query、Pager 就会无数据。

解决方案:

形参query、pager 改为其他命名(比如model)

public async Task<IActionResult> List([FromQuery]PagerQuery<XxxxxxQuery> model)

 

 

2、Sql关联查询时,某实体中字段报:'xxxxxx' requires a primary key to be defined
但此实体对应数据库中表是有主键的,实体此处也不需要设置主键

项目从.net core 2.1.0升级到.net core 2.2.4,原有项目出错及解决方案

 

解决方案:

实体'xxxxxx'中的字段Id改为其他命名,估计是框架中的Id与实体中声明的Id有一定冲突

public int? Id { get; private set; } //将Id改为其他命名

 

相关文章:

  • 2022-12-23
  • 2018-04-20
  • 2021-12-24
  • 2021-10-01
  • 2021-10-08
  • 2020-05-06
  • 2021-09-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2022-01-08
  • 2021-06-06
  • 2021-08-31
相关资源
相似解决方案