-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollback #4
Comments
Hi, |
It's all VB
|
The command looks ok, but where is the following code from?
|
Understood, since your example had only one annotation for the mandatory Commit i thought the Rollback was automatic as you said, as if it doesn't need an extra Try...Catch block, it got me confused, that's why i was wondering what did i do wrong. And sorry for the late answer even after taking your time, i was driving back home. UnitOfWork(Repository) Execute method, reverted back to its inital state.
And the implementation of the repository within the Main method of a console application:
I also noticed that your code implements an exception handler, is he responsible for rolling back the transaction and/or avoiding the commit ? |
Since the transaction is explicitly started, if not committed it gets rolled back. There is no need to issue a rollback in a catch block. Of course if you have modified the original code, things may not work as expected :-) |
Yeah, i work with more complex and bulk data and debug is the only thing that keeps me on track(most of times). I was using an old implementation and not much of eficient as i expected, was just a hack apparently and now i'm replacing the code i have because i'm about to add more functionality and right now Dapper is the only thing working with my models. Thanks for the feedback man. |
Hi there, how does rollback occours in your code ?
Lets say i have a table with the following fields:
When i try to insert two people in row like.
The first query executes without any throuble as it should, but after the second query where i try to insert an existing constraint i get the exception but the commit accours for the first query.
My repository's execute method looks like this:
The text was updated successfully, but these errors were encountered: