You'll have to force the
Origins
collection into an in-memory
Enumerable
, first:
var q = from r in db.Origins.AsEnumerable() where Regex.IsMatch("Potov", r.Pattern) select r.Origin;
Now Linq is not looking for
IsMatch()
as a SQL function, but as a .Net object's method - which it will find.
See
Enumerable.AsEnumerable<TSource>[
^].
Linq-to-SQL objects implement
IQueryable<TSource>[
^] - which translates the Lambdas into SQL queries (which, in the case of your example above, fails). The cast to
AsEnumerable
forces Linq to use the Linq-to-objects Where method instead.