如何在Entity Framework

时间:2018-01-10 00:52:14

标签: c# entity-framework

我有一组订单ID,需要使用特定值进行更新。如何使用Entity Framework执行此操作? 如果这是一个sql语句,它将类似于

update orders set status = 'sold' where id in (1,2,3,4,5,6)

我在想它可能是这样的

_dbcontext.Orders.Where(o=>o.Contains(ids)).Select(s=>s.Status)="sold";
_dbcontext.SaveChanges();

1 个答案:

答案 0 :(得分:1)

您可以使用以下

mongodb_1     | 2018-01-09T21:57:14.353+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
mongo_seed_1  | 2018-01-10T00:19:58.286+0000    [........................] test.census 0B/1KB (0.0%)
mongo_seed_1  | 2018-01-10T00:19:58.332+0000    [........................] test.census 0B/1KB (0.0%)
mongo_seed_1  | 2018-01-10T00:19:58.332+0000    Failed: error connecting to db server: no reachable servers
mongo_seed_1  | 2018-01-10T00:19:58.332+0000    imported 0 documents

希望这会对你有所帮助