Skip to main content
Nintex Community Menu Bar

Hi

 

I have console application which uses C# classes generated by "SmartObjects - Services - Tester". I have also two SmartBox SmartObjects: SO1 and SO2. I would like to do something like this:


 

using (var ts = new TransactionScope(TransactionScopeOption.Required)){var so1 = new SO1();so1.Test1 = "TEST_1";var z = so1.Create();//throw new ApplicationException("TEST");var so2 = new SO2();so2.Test2 = "TEST_2"var zz = so2.Create();}

 

 

But there was no database transaction. I checked it by SQL Profiler.

 

I was trying to create third SmartObject which had method bind to two methods. One from SO1 and one from SO2 and there was still no transaction on database. I checked it by SQL Profiler. (screen1.png)

 

Then I changed SO1 to "Advance SmartObject" and then changed "Transaction" from Continue to Rollback. But when I clicked on finish button there was an error and no message in HostServer logs (screen2.png and screen3.png).

 

Is there any option to enclose two SmartObject methods to one database transaction?


15025iD3593306E421DA7E.bmp
14027i570BAAADE052A83C.bmp
15463iB78B4C14C09EC9CF.bmp
14557i5C01494D6F7CBFFA.bmp
15972iAC1C0612E65DE251.bmp
10990i51590A4BC10C0B8D.bmp

Not without writing your own custom servicebroker I'm afraid. The whole point of the SmartObject abstraction is to save us from having to worry about the nitty-gritty of transactions etc.


 


That said, it's highly extensible. If this is a requirement that you HAVE to have, I'd recommend creating a servicebroker provides methods for creating and committing transactions.


 


See here for details of how to create a custom servicebroker: http://webcache.googleusercontent.com/search?q=cache:3EoJ6uS3rSQJ:k2underground.com/cfs-filesystemfile.ashx/__key/CommunityServer.Components.PostAttachments/00.00.03.53.57/Tech-Article-_2D00_-Developing-a-Custom-Service.pdf+&cd=1&hl=en&ct=clnk


Hi,

 

ServiceBroker Link is not working anymore.

 

I have followed this URL

http://www.velocity-it.com/k2-and-net-transactions/#comment-745

 

 

Regards

Asad Naeem


Hi,
We need to add System.Transactions.dll in references then add the namespace as using System.Transactions;. Now we will be able to access TransactionScope class. :)

Regards,
Asad Naeem


Reply