edis0n0
V2EX  ›  .NET

ef core 关联不上的属性默认是用 NULL 表示,怎么改成用 0 表示?(因为有一个运行了几年的 PHP 老系统用的是 0,要继承他的数据库)直接把默认值改成 0 的话会提示外键错误。

  •  
  •   edis0n0 · Dec 31, 2022 · 1894 views
    This topic created in 1240 days ago, the information mentioned may be changed or developed.
    2 replies    2023-01-28 23:34:57 +08:00
    hervey0424
        1
    hervey0424  
       Jan 1, 2023
    类型是 int 的默认就是 0 啊, int?的才是 null
    whevether
        2
    whevether  
       Jan 28, 2023
    别用外键关联啊。include 关联.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5346 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 03:55 · PVG 11:55 · LAX 20:55 · JFK 23:55
    ♥ Do have faith in what you're doing.