EF.Functions.Like throws "has no supported translation to SQL" error
I'm using latest beta of LINQPad on .NET 5.0 and with Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.SqlServer (both version 5.0.9) against SQL Server 2016 SP1.
This query
var customers = from t in Tb_Customer where EF.Functions.Like(t.Name, "a%") select t;
throws NotSupportedException exception with message
Method 'Boolean Like(Microsoft.EntityFrameworkCore.DbFunctions, System.String, System.String)' has no supported translation to SQL.
Source is SD.Tools.LinqToSQL2.
When I try similar LINQ query in my ASP.NET Core project, there is no error, so query and referenced seems OK.
What am I doing wrong?
Thank you for you help.
Comments
If the source is SD.Tools.LinqToSQL, you are using a LINQ-to-SQL connection, not an EF Core connection. You should use SqlMethods.Like instead of EF.Functions.Like.
Thank you, Joe, for solving my problem. I've never used Entity Framework from within LinqPad. Now I know how to do it.