Use linq to generate direct update without select

前端 未结 7 911
感情败类
感情败类 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:23

    The PLINQO (http://plinqo.com) framework is using the LINQ batch update to perform updates

    context.Task.Update(t => t.Id == 1, t2 => new Task {StatusId = 2});

    This will perform a Update Task Set StatusId = 2 Where Id = 1

提交回复
热议问题