Can "Elastic Database Transactions" work from Azure Functions and/or App Services? -
the documentation on distributed transactions across multiple sql azure databases mentions guest os environments running transaction must have .net 4.6.1 . case azure functions and/or app services?
i tested distributed transactions on azure web app using following code. if throw exception before invoke scope.complete, transaction roll , records not saved tables. proves azure app services did support elastic database transactions.
using (var scope = new transactionscope()) { using (var conn1 = new sqlconnection(azuresqlconnstrdb1)) { conn1.open(); sqlcommand cmd1 = conn1.createcommand(); cmd1.commandtext = string.format("insert t1 values(3)"); cmd1.executenonquery(); } using (var conn2 = new sqlconnection(azuresqlconnstrdb2)) { conn2.open(); var cmd2 = conn2.createcommand(); cmd2.commandtext = string.format("insert t2 values(4)"); cmd2.executenonquery(); } throw new exception("i exception"); scope.complete(); }
Comments
Post a Comment