我正在使用EF Core开发asp.net核心应用程序。我有实体“消息”。添加字段后
public byte[] Timestamp { get; set; }
并使用IsRowVersion进行配置
modelBuilder.Entity<Message>(entity =>
{
...
entity.Property(c => c.Timestamp).IsRowVersion();
});
我总是在新迁移中进行修改:
migrationBuilder.AlterColumn<DateTime>(
name: "Timestamp",
table: "Messages",
rowVersion: true,
nullable: true,
oldClrType: typeof(DateTime),
oldNullable: true);
我可以创建10个新的迁移,它将始终包含此AlterColumn。
为什么?如何防止生成此AlterColumn指令?
UPD:我使用Pomelo.EntityFrameworkCore.MySql连接器