so.. I'm using LinqToEntities, and I want to query part of a field. Normally I'd use the LIKE keyword with SQL, and then go from there..
I see that Linq does not have it.. Whats a good way to get the same kind of functionality?
so.. I'm using LinqToEntities, and I want to query part of a field. Normally I'd use the LIKE keyword with SQL, and then go from there..
I see that Linq does not have it.. Whats a good way to get the same kind of functionality?
You can use String.StartsWith()
or String.Contains()
.
For example:
var query = from b in db.Books
where b.Title.Contains("time")
select b;
This works because LINQ turns the query into an expression tree, and for LINQ to SQL/Entities, many "standard" C# methods are supported for the conversion to SQL.