Delete in a transaction?


Author
Message
fparker
fparker
StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)StrataFrame Beginner (49 reputation)
Group: Forum Members
Posts: 31, Visits: 199
I have a form with three business objects on it.  They are configured such that two of them are children of the third.  The parent object is identified as the form's primary business object.  When the user clicks the delete button on the maintenance form toolstrip, I'd like the parent record and the both sets of child records to be deleted in a single transaction.  I overrode the form's delete method as follows:

public override void Delete(bool OnlyMarkAsDeleted, bool CheckSecurity)

{
 MicroFour.StrataFrame.Business.BusinessLayer.TransactionBegin("", IsolationLevel.ReadCommitted);

 foreach (BusinessLayer BO in this.BusinessObjects)
  if (BO != this.PrimaryBusinessObject)
   while (BO.Count > 0)
    {

      BO.MoveFirst();
      BO.DeleteCurrentRow(false);

    }

 this.PrimaryBusinessObject.DeleteCurrentRow(false);
 MicroFour.StrataFrame.Business.BusinessLayer.TransactionCommit("");

}

This code works fine except that the deletes are not really performed inside of a database transaction.  Is there a way to get StrataFrame to do what I want or should I write my own ADO code?  If I do write my own ADO code to do the deletes, how can I get the business objects to remove the rows in question from their in memory data tables?

Thanks for your help.

Fran Parker



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search