<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : public override void Delete() no more</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2009 : public override void Delete() no more</description>
  <pubDate>Sat, 11 Apr 2026 07:50:58 -700</pubDate>
  <lastBuildDate>Thu, 06 Nov 2008 06:27:08 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=988</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>public override void Delete() no more :  Originally posted by sebma In...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=988&amp;PID=3574#3574</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 988<br /><strong>Posted:</strong> 06-Nov-2008 at 6:27am<br /><br /><table width="99%"><tr><td class="BBquote"><strong><em>Originally posted by sebma</strong></em><br /><br /><DIV>In both cases, the entity's EntityAspect.EntityState is not in a state of Deleted. Is this as designed?</DIV></td></tr></table> <DIV>&nbsp;</DIV><DIV>I'm not positive I understand your question, but...</DIV><DIV>&nbsp;</DIV><DIV>EntityState.Deleted means the entity is marked for physical deletion and that the corresponding row in the back-end database will be physically deleted as of the next save.&nbsp; If you're implementing a "soft delete" scheme, then delete doesn't really mean delete in the physical sense; so you would not want the EntityState to be Deleted after the operation.</DIV><DIV>&nbsp;</DIV><DIV>If, by your question "Is this as designed?" you mean the fact that EntityState != Deleted after calling Cancel within the handler, then yes, that is as designed.</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 06 Nov 2008 06:27:08 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=988&amp;PID=3574#3574</guid>
  </item> 
  <item>
   <title>public override void Delete() no more : I was overriding the Delete()...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=988&amp;PID=3573#3573</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=370" rel="nofollow">sebma</a><br /><strong>Subject:</strong> 988<br /><strong>Posted:</strong> 06-Nov-2008 at 6:08am<br /><br /><DIV>I was overriding the Delete() method to implement soft deletes, which basically set my database-table-row status flag to inactive.</DIV><DIV>&nbsp;</DIV><DIV>With the release of DevForce EF Version 4.2.1.5, there is no longer an overrideable Delete() method on an entity.</DIV><DIV>From the release notes, we would configure our entities&nbsp;to handle EntityChangingEventArgs and EntityAction.Delete, in which it is still possible to direct the handler to set my database-table-row status flag to inactive. However, the database-table-row is still being physically deleted. To prevent it from being physically deleted from database, I would need to have something like this in my handler</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void OnMyEntityChanging&lt;T&gt;(object sender, EntityChangingEventArgs e) where T : Entity<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (e.Action == EntityAction.Delete)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; T thisObj = (T)e.Entity;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (this.Equals(thisObj)) // because&nbsp;this handler is registered to EntityGroup of a&nbsp;Type, I need to ignore the event if it&nbsp;does not belong to this instance<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Delete(); // calls my&nbsp;derived class delete which actually sets&nbsp;my own status flag to inactive<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>e.Cancel = true; //&nbsp;Cancel the delete action&nbsp;to prevent physical delete</strong><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV><DIV>&nbsp;</DIV><DIV>Another simple way is just&nbsp;simply&nbsp;my own public DeleteMe() method on my entities which basically does an update (setting database-table-row status flag to inactive).</DIV><DIV>&nbsp;</DIV><DIV>In both cases, the entity's EntityAspect.EntityState is not in a state of Deleted. Is this as designed?</DIV><DIV>&nbsp;</DIV><DIV>Thanks and best regards,</DIV><DIV>Sebastian</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 06 Nov 2008 06:08:12 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=988&amp;PID=3573#3573</guid>
  </item> 
 </channel>
</rss>