简体   繁体   中英

how to write entity framework query as like **like 'lap%'**

I can't understand how can I write query like

select * from product where name like 'Lap%' 

in Entity Framework

my dbcontext is

 dbFoodZoonEntities1 db = new dbFoodZoonEntities1();

Try this

dbFoodZoonEntities1 db = new dbFoodZoonEntities1();
var result = db.product.Where(x=>x.name.StartsWith("Lap")).ToList();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM