EF CORE 6.0

ToView ,如果使用了ToView,最好检查下是不是真的是ToView,在ef core 3.1中会自动兼容,即使你把ToTable写成了ToView,也不会有什么问题,但是在ef core 6.0中会出错,提示如下:

The entity type 'CrmStore' is not mapped to a table, therefore the entities cannot be persisted to the database


EF CORE 7.0

断崖式升级,需要特别注意,生成的语句大有不同(除非硬性要求,否则不建议升级到7.0及以上)

例如插入,

原语句获得id的方式是使用

SELECT SCOPE_IDENTITY() AS NewID;

但新的是使用OUTPUT

INSERT INTO YourTable (Column1, Column2)
OUTPUT INSERTED.ID AS NewID
VALUES ('Value1', 'Value2');