简体   繁体   English

向上更新列使用simple.data添加到当前值

[英]Upserting column add to current value with simple.data

Trying to upsert with simple.data and i would like to add to current value if matched, and otherwise just use provided value. 尝试使用simple.data进行更新,如果匹配,我想添加到当前值,否则仅使用提供的值。

This fails if Id=13 does not exist. 如果Id = 13不存在,则失败。

var table = db.TheTable2;
table.UpsertById(Id: 13, Value: table.Value + 10); // Want a row ID=13, Value=10 if not exist, otherwise Value=Value+10.

This works because Id=13 exists 这是有效的,因为Id = 13存在

var table = db.TheTable2;
table.UpsertById(Id: 13, Value: 10);
table.UpsertById(Id: 13, Value: table.Value + 10);

How to do? 怎么做?

That is not supported at present. 目前不支持该功能。 You could open an issue at https://github.com/markrendle/Simple.Data/issues to request the feature. 您可以在https://github.com/markrendle/Simple.Data/issues中打开问题以请求该功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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