Domanda

Trying to upsert with simple.data and i would like to add to current value if matched, and otherwise just use provided value.

This fails if Id=13 does not exist.

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

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

How to do?

È stato utile?

Soluzione

That is not supported at present. You could open an issue at https://github.com/markrendle/Simple.Data/issues to request the feature.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top