EF核心始终在IsRowVersion字段上创建迁移

时间:2019-09-26 12:49:32

标签: c# entity-framework asp.net-core entity-framework-core ef-migrations

我正在使用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连接器

0 个答案:

没有答案