c# - Return actual patched property value from patchcommand in RavenDb -
a have "billing" class that's describe finance account model in multithreading application. if want transfer money 1 billing make patchcommand increment 1 property , decrement another. right way return actual property value after patching without redundant load-query?
billing class
public class billing { public string id { get; set; } public decimal balance { get; set; } }
my patch method
public void transfermoney(string billingsrc, string billingdst, decimal money) { _ctx.databasecommands.batch(new icommanddata[] { new scriptedpatchcommanddata { key = billingsrc, patch = new scriptedpatchrequest { script = @"this.balance -= money;", values = {{"money", money}} } }, new scriptedpatchcommanddata { key = billingdst, patch = new scriptedpatchrequest { script = @"this.balance += money;", values = {{"money", money}} } } }); }
you can use output()
method send values user.
Comments
Post a Comment