【发布时间】:2023-03-24 22:08:01
【问题描述】:
我需要将AspNetUsers 中的键列Id 从字符串更改为整数。
除了start-up.Auth 配置(我只有
app.UseCookieAuthentication(new CookieAuthenticationOptions());)
尝试注册用户时,我收到此错误:
无法将值 NULL 插入到列“Id”、表“click2lockdb.dbo.AspNetUsers”中;列不允许空值
我尝试手动添加 ID:
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override int Id { get; set; }
但我仍然遇到同样的错误。
【问题讨论】:
标签: c# asp.net-core asp.net-web-api