c# - TransactionScope with nested methods - MySQL -


does mysql support transactionscope without passing mysqlconnection object parameter? or work ms sql 2008 , above?

for example:

public void method() {     using (var scope = new system.transactions.transactionscope())     {         delete();         insert();         update();          scope.complete();     } }  public void update() {      using(mysqlconnection conn = new mysqlconnection())      {          // update in database      } }  public void insert() {      using(mysqlconnection conn = new mysqlconnection())      {          // insert in database      } }  public void delete() {      using(mysqlconnection conn = new mysqlconnection())      {          // delete database      } } 

or should mysqlconnection conn object parameter?

public void method() {     using (var scope = new system.transactions.transactionscope())     {         using(mysqlconnection conn = new mysqlconnection())         {             delete(conn);             insert(conn);             update(conn);         }          scope.complete();     } }  public void update(mysqlconnection conn) {     // update in database }  public void insert(mysqlconnection conn) {     // insert in database }  public void delete(mysqlconnection conn) {     // delete database } 


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -