插入数据Insert,会把CreateTime字段排除掉,手动赋值CreateTime不会排除掉 返回

SqlSugar 老数据
6 1365
该叫什么 Jeff 发布于2021/10/16
悬赏:5 飞吻

image.png

image.png

热忱回答6

  • Jeff Jeff VIP0
    2021/10/16

    image.png

    0 回复
  • fate sta fate sta VIP0
    2021/10/16
    public class Order
    {
            [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
            public int Id { get; set; }
     
            public string Name { get; set; }
            public decimal Price { get; set; }
            [SugarColumn(IsOnlyIgnoreInsert =true)]//设置后插入会取数据库默认值
            public DateTime CreateTime { get; set; }
    }


    0 回复
  • fate sta fate sta VIP0
    2021/10/16

    最简单的方式上加上  IsOnlyIgnoreInsert 

    0 回复
  • fate sta fate sta VIP0
    2021/10/16

    或者用updatecolumns指定哪些列插入

    0 回复
  • Jeff Jeff VIP0
    2021/10/16

    @fate sta:不好意思,是我写错了,不能这样写

    image.png

    0 回复
  • fate sta fate sta VIP0
    2021/10/17

    SqlSugarCore 5.0.4.3-Preview01  版本发布过了,就修复了你的过滤器多表查询多参数的问题 

    0 回复