Entity Framework Core 5.0 now supports the translation of String.FirstOrDefault() LINQ queries.
In EF Core 3.1 the following would fail…
with an error message similar to below but in 5.0 it translates into a query using substring().
Note… a potential performance gotcha with EF Core < 3.0 was that any queries it couldn’t translate were evaluated on the client (.NET side). This often resulted in performance problems in production as huge numbers of records could be returned to the client AND THEN filtered. Since version 3.0 Entity Framework Core will throw an exception if anything can’t be translated but watch out for this in earlier versions.