Reputation: 1640
I am using MySQL Connector .NET with EntityFramework 6, version 6.9.5.0.
I build a query with a "LIKE" like this :
var q = from u in ctx.Db.users
where u.name.StartsWith(query)
select u;
It is compiled to this :
SELECT
...
FROM `user` AS `Extent1`
WHERE `Extent1`.`name` LIKE 'p__linq__0%'
So my query fails, because my users' name will never be like this... (maybe one day ?)
Is it a bug, an expected behavior or do I have missed something ?
Thanks.
Upvotes: 1
Views: 591
Reputation: 51
You could use the following code
var q = from u in ctx.Db.users
where u.name.StartsWith(query.Trim())
select u;
it works fine
Upvotes: 0