Use linq to generate direct update without select

前端 未结 7 900
感情败类
感情败类 2020-11-29 05:34

G\'day everyone.

I\'m still learning LINQ so forgive me if this is naive. When you\'re dealing with SQL directly, you can generate update commands with conditionals

7条回答
  •  粉色の甜心
    2020-11-29 06:19

    Try this :

    dbEntities.tblSearchItems
         .Where(t => t.SearchItemId == SearchItemId)
         .ToList()
         .ForEach(t => t.isNew = false);
    dbEntities.SaveChanges();
    

提交回复
热议问题