Delete and Save for the same object #4010
Unanswered
Chicagoan2016
asked this question in
Questions
Replies: 1 comment 1 reply
-
For inserts, you want to do a regular insert? I don't know what database provider you are using, but you should be able to use a TransactionScope and make separate delete and insert database calls over the same database connection, all within the "Update" logic of the logical server-side data portal. Both actions will be executed in the same transaction context. If the insert fails, the delete will be rolled back. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi fellow members,
We have a requirement where each update needs to go to the database as a new 'Insert'.
We retrieve the object in Data Portal's Create method and we also set the primary key(int) to zero in the same method.
So far so good, Csla made it a breeze. We are now asked to delete the 'previous' object. We added a new property (say) 'PreviousPK' and we stored the retrieved primary key there and called Delete on PreviousPK, again easy :)
We would like to package the two calls 'Delete' and 'Save' in one transaction.
We could use a unit of work object but since both methods belong to the same object do we need unit of work or maybe there is a simpler way?
Kind Regards
Beta Was this translation helpful? Give feedback.
All reactions