2015 m. gruodžio 16 d., trečiadienis

LINQ transactions

odb.Connection.Open()
            odb.Transaction = odb.Connection.BeginTransaction()
            Try
  odb.procedureA(1)
                odb.procedureB(2)
                odb.procedureC(3)
                odb.procedureD(4)
                  
                odb.Transaction.Commit()
            Catch ex As Exception
                WebEmail.SendExceptionEmail("dsk@abc.lt", "CRC deadlock", Server.GetLastError)
                odb.Transaction.Rollback()
                ScriptManager.RegisterStartupScript(Me, Me.GetType, "CloseD", "alert('An error occurred. Please do not close window and try again after 5 minutes!');", True)
            Finally
                odb.Connection.Close()
            End Try




Su odb.SubmitChanges - tinka tik mazom operacijom
Kai distributed užklausos, geriau dirbti su transactionScope

Komentarų nėra:

Rašyti komentarą