﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Delete in a transaction?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 04:12:13 GMT</lastBuildDate><ttl>20</ttl><item><title>Delete in a transaction?</title><link>http://forum.strataframe.net/FindPost6532.aspx</link><description>&lt;FONT size=2&gt;I have a form with three business objects on it.&amp;nbsp; They are configured such that two of them are children of the third.&amp;nbsp; The parent object is identified as the form's primary business object.&amp;nbsp; 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&amp;nbsp;transaction.&amp;nbsp; I overrode the form's delete method as follows:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;public override void Delete(bool OnlyMarkAsDeleted, bool CheckSecurity)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;MicroFour.StrataFrame.Business.BusinessLayer.TransactionBegin("", IsolationLevel.ReadCommitted);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;foreach (BusinessLayer BO in this.BusinessObjects)&lt;BR&gt;&amp;nbsp;&amp;nbsp;if (BO != this.PrimaryBusinessObject)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (BO.Count &amp;gt; 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BO.MoveFirst();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BO.DeleteCurrentRow(false);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;this.PrimaryBusinessObject.DeleteCurrentRow(false);&lt;BR&gt;&amp;nbsp;MicroFour.StrataFrame.Business.BusinessLayer.TransactionCommit("");&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;This code works fine except that the deletes are not really performed inside of a database transaction.&amp;nbsp; Is there a way to get StrataFrame to do what I want or should I write my own ADO code?&amp;nbsp; 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?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Thanks for your help.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;Fran Parker&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Thu, 08 Feb 2007 10:42:56 GMT</pubDate><dc:creator>fparker</dc:creator></item><item><title>RE: Delete in a transaction?</title><link>http://forum.strataframe.net/FindPost6648.aspx</link><description>Your best bet would be to change the DeleteCurrentRow(false) to DeleteCurrentRow(true) which will only mark the records as deleted.&amp;nbsp; Then, call BusinessObject.Save(true); so that the business object will save the records on the transaction.</description><pubDate>Thu, 08 Feb 2007 10:42:56 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Delete in a transaction?</title><link>http://forum.strataframe.net/FindPost6624.aspx</link><description>Any thoughts about this?&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;Fran</description><pubDate>Wed, 07 Feb 2007 13:47:27 GMT</pubDate><dc:creator>fparker</dc:creator></item></channel></rss>