Migrating from EF Core 2 to EF Core 3

后端 未结 2 1195
南旧
南旧 2021-01-04 08:34

After upgrading my project from (dotnet core 2/ef core 2) to (dotnet core 3/ef core 3) almost all of my entity framework LINQ queries are broken. while I already read this i

2条回答
  •  有刺的猬
    2021-01-04 09:18

    1. use OrderByDesc() for some property and then FirstAsync(). (https://github.com/aspnet/EntityFrameworkCore/issues/18211)

    2. the invariant compare is not translated, was probably client evaluated previously. Depending on your database collation setting you could probably just do a normal equals here.

    Calling AsEnumerable() on your DbSet without any filters will pull down all data locally, not something you want to do in production. Try rewriting to above and monitor the generated SQL to ensure that you get performant queries.

提交回复
热议问题