You can do this:
using System.Data.Entity; // EntityFramework.dll v4.3
var queryResult=db.Accounts.AsQueryable().Where(x => x.Name.Contains(queryKey));
because Linq to Entity
can't transform the method Contains()
to the SQL, but Linq to SQL can do this. I tried to find a method that can doing a cast, at last, AsQueryable()
, also a generic version AsQueryable()
. I found I can do this using it this way in my case, but any side effect it has I don't know, maybe it will lose some feature at Entity
.