How this can be done in Atomic way?
-
Class A { B bsObject; public void FunctionOfClassA() { bsObject.FunctionOfClassB() } } Class B { public void FunctionOfClassB() { } } I have my program structure as shown above. I want a way to apply atomicity to this. I mean if Class B's data write worked fine but Class A's calculations failed then want to rollback the data write. i want it all succeed or rollback. One way i can think of is to create a DB ptr and begin transaction just before call to FunctionOfClassB() and pass it as a parameter. so in this FunctionOfClassB will use same db ptr to write data. And it would also be possible in FunctionOfClassA() to check if calculations went ok then commit or rollback. My requirement is to not to make any change in parameter list or not to provide a new method with new parameter. Class A { B bsObject; public void FunctionOfClassA() { bsObject.FunctionOfClassB() // some calculations // Here I want to decide whether to commit or rollback } } Class B { public void FunctionOfClassB() { // here i want to begin a transaction // some data writing. } } Can anyone give an high level summary how this could be possible?
-
Class A { B bsObject; public void FunctionOfClassA() { bsObject.FunctionOfClassB() } } Class B { public void FunctionOfClassB() { } } I have my program structure as shown above. I want a way to apply atomicity to this. I mean if Class B's data write worked fine but Class A's calculations failed then want to rollback the data write. i want it all succeed or rollback. One way i can think of is to create a DB ptr and begin transaction just before call to FunctionOfClassB() and pass it as a parameter. so in this FunctionOfClassB will use same db ptr to write data. And it would also be possible in FunctionOfClassA() to check if calculations went ok then commit or rollback. My requirement is to not to make any change in parameter list or not to provide a new method with new parameter. Class A { B bsObject; public void FunctionOfClassA() { bsObject.FunctionOfClassB() // some calculations // Here I want to decide whether to commit or rollback } } Class B { public void FunctionOfClassB() { // here i want to begin a transaction // some data writing. } } Can anyone give an high level summary how this could be possible?
-
Class A { B bsObject; public void FunctionOfClassA() { bsObject.FunctionOfClassB() } } Class B { public void FunctionOfClassB() { } } I have my program structure as shown above. I want a way to apply atomicity to this. I mean if Class B's data write worked fine but Class A's calculations failed then want to rollback the data write. i want it all succeed or rollback. One way i can think of is to create a DB ptr and begin transaction just before call to FunctionOfClassB() and pass it as a parameter. so in this FunctionOfClassB will use same db ptr to write data. And it would also be possible in FunctionOfClassA() to check if calculations went ok then commit or rollback. My requirement is to not to make any change in parameter list or not to provide a new method with new parameter. Class A { B bsObject; public void FunctionOfClassA() { bsObject.FunctionOfClassB() // some calculations // Here I want to decide whether to commit or rollback } } Class B { public void FunctionOfClassB() { // here i want to begin a transaction // some data writing. } } Can anyone give an high level summary how this could be possible?
paresh_joe wrote:
My requirement is to not to make any change in parameter list or not to provide a new method with new parameter.
If so as above, then how can you (down below) pass the pointer since your function accepts no parameters in your skeleton class.
paresh_joe wrote:
One way i can think of is to create a DB ptr and begin transaction just before call to FunctionOfClassB() and pass it as a parameter.
Please reword.
-
paresh_joe wrote:
My requirement is to not to make any change in parameter list or not to provide a new method with new parameter.
If so as above, then how can you (down below) pass the pointer since your function accepts no parameters in your skeleton class.
paresh_joe wrote:
One way i can think of is to create a DB ptr and begin transaction just before call to FunctionOfClassB() and pass it as a parameter.
Please reword.
I meant to say that only solution come to my mind is to pass DB parameter to function which is not possible. I want some other way in which this can be implemented.
-
I meant to say that only solution come to my mind is to pass DB parameter to function which is not possible. I want some other way in which this can be implemented.
Can the server function throw an exception if transaction is not completed? Yes, then you can handle it in the client and do whatever you need to. Another approach is, if you can, to introduce two events in the server method which can be raised when the server method either completes or fails. This event will have one parameter derived from the EventArgs class (if using .NET) and it can contain information about what happened during the transaction--what failed and what passed. What do you think?
-
paresh_joe wrote:
My requirement is to not to make any change in parameter list or not to provide a new method with new parameter.
If so as above, then how can you (down below) pass the pointer since your function accepts no parameters in your skeleton class.
paresh_joe wrote:
One way i can think of is to create a DB ptr and begin transaction just before call to FunctionOfClassB() and pass it as a parameter.
Please reword.
Hi sumit here
-
I meant to say that only solution come to my mind is to pass DB parameter to function which is not possible. I want some other way in which this can be implemented.
Hello sam here
-
Can the server function throw an exception if transaction is not completed? Yes, then you can handle it in the client and do whatever you need to. Another approach is, if you can, to introduce two events in the server method which can be raised when the server method either completes or fails. This event will have one parameter derived from the EventArgs class (if using .NET) and it can contain information about what happened during the transaction--what failed and what passed. What do you think?
I REALLY DONT KNOW.........PLS HELP
-
Hello sam here
test today
-
test today
tesst 5 min
-
I REALLY DONT KNOW.........PLS HELP
I don't understand what you are asking. You are back after a long time! Can you be more clear about your question?
CodingYoshi Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07