I was getting the same error but it was due to the use of openjson in sql query .Contains method in the newer version of EF Core translates to openjson to increase efficiency but it is not supported by the older versions of some databases. And if you dont want to shift to the newer database version you can use these options :
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseSqlServer(@"<CONNECTION STRING>", o => o.UseCompatibilityLevel(120));
You can refer this document : https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-8.0/breaking-changes