- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
升级到 Asp.Net Core 3.0 后,尝试创建用户时,我的 Identity 类出现以下错误:
Unable to track an entity 'User' of type because primary key property 'id' is null.
var result = await _userManager.CreateAsync(user, password);
最佳答案
这是由于 EF Core 3.0 中的重大更改,可在此链接下找到:
https://docs.microsoft.com/en-us/ef/core/what-is-new/ef-core-3.0/breaking-changes#string-and-byte-array-keys-are-not-client-generated-by-default
该问题可以通过手动分配一个键来解决,如下所示:
// assign GUID to Id
user.Id = Guid.NewGuid().ToString();
var result = await _userManager.CreateAsync(user, password);
The pre-3.0 behavior can be obtained by explicitly specifying that the key properties should use generated values if no other non-null value is set. For example, with the fluent API:
modelBuilder
.Entity<Blog>()
.Property(e => e.Id)
.ValueGeneratedOnAdd();
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }
关于c# - 无法跟踪类型实体,因为主键属性 'id' 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59134406/
我在右侧有一个主 div 和一个侧边栏(用于导航/过滤器)。主 div 用于显示日志文件,在任何情况下都不应写入右侧栏。 问题:当出现没有空格的很长的消息(例如很长的文件路径)时,它将写入我的右侧栏。
我想根据内部从 TableView 的高度动态设置主 TableView 的行高。实现这一目标的最佳方法是什么? 最佳答案 尝试使用 UITableViewAutomaticDimension 动态设
我正在尝试为 GridLayout 调用 findviewbyid,但无论我放置在哪里,它都会返回 null。在设置 contentView 并膨胀 ViewStub 后,我将其称为 onCreate
对于一个巨大的 myisam 表(超过 1B 行),我有 2 个唯一变量,其中一个有 18 个数字,另一个有 10 个拉丁字符。 我应该选择哪一个作为主键? 如果是数字;小数还是大整数? 它们都不能帮
我有一个包含 19 行的用户表(第一行是 admin)。我需要添加更多内容,因此我有另一个数据库,其中的表有超过 1,400,000 个用户。 我的表有一个“user_id”作为主键,INT(11),
我是一名优秀的程序员,十分优秀!