Hxj.data V1.5.1 version begins to support field combination updates.
For example: Update table Set A=b+c
Update table Set a=a+1
(+ 、-、 *,/,%) by analogy.
Here is a concrete example. (examples are just for test results, no practical significance)
Example One,
DbSession.Default.Update<Products>(Products._.UnitPrice, Products._.ReorderLevel + Products._.UnitPrice, Products._.ProductID == 1);
The generated SQL is as follows:
Text:
UPDATE [Products] SET [UnitPrice]=[Products].[ReorderLevel] + [Products]. [UnitPrice]
WHERE [Products].[ProductID] = @mjpxqimmtmiyguvv
Parameters:
@mjpxqimmtmiyguvv [Int32] = 1
is to update the value of the UnitPrice field to the value of UnitPrice plus reorderlevel field.
Cases II,
Dbsession.default.update<products> (products._. UnitPrice, Products._. UnitPrice + 1, products._. ProductID = = 1);
The generated SQL is as follows:
Text:
UPDATE [Products] SET [UnitPrice]=[Products].[UnitPrice] + @tszvynxwnukkjuzj
WHERE [Products].[ProductID] = @anuixieadujzvvka
Parameters:
@tszvynxwnukkjuzj[Int32] = 1
@anuixieadujzvvka[Int32] = 1
Here is the value of the UnitPrice field plus 1.