<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Cascade Delete and 1-to-1 (or 1-to-0..1) Relationships</title><link>http://blogs.msdn.com/b/dsimmons/archive/2010/02/06/cascade-delete-and-1-to-1-or-1-to-0-1-relationships.aspx</link><description>Here’s another episode in my ongoing mission to help folks be successful using the Entity Framework, as well as to learn more about how folks use the Entity Framework so that each release will be better than the last. Today’s task: Using cascade delete</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Cascade Delete and 1-to-1 (or 1-to-0..1) Relationships</title><link>http://blogs.msdn.com/b/dsimmons/archive/2010/02/06/cascade-delete-and-1-to-1-or-1-to-0-1-relationships.aspx#10182428</link><pubDate>Fri, 01 Jul 2011 17:08:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10182428</guid><dc:creator>Daniel Simmons - MSFT</dc:creator><description>&lt;p&gt;I haven&amp;#39;t checked (I&amp;#39;m no longer part of the EF team), but I think it highly unlikely that this issue was addressed in EF 4.1 since that was a release that only added support for code-first development on top of the same core EF bits that are in EF 4.0--it didn&amp;#39;t change the core EF DLLs. &amp;nbsp;The next full release of the EF, though, (which I gather is now available as a CTP) may have fixed this issue.&lt;/p&gt;
&lt;p&gt;You might want to ask on the EF forums to get confirmation one way or another of whether or not this issue is fixed in that CTP.&lt;/p&gt;
&lt;p&gt;Good luck!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10182428" width="1" height="1"&gt;</description></item><item><title>re: Cascade Delete and 1-to-1 (or 1-to-0..1) Relationships</title><link>http://blogs.msdn.com/b/dsimmons/archive/2010/02/06/cascade-delete-and-1-to-1-or-1-to-0-1-relationships.aspx#10182352</link><pubDate>Fri, 01 Jul 2011 13:47:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10182352</guid><dc:creator>Ravi Pathak</dc:creator><description>&lt;p&gt;Hi Danny&lt;/p&gt;
&lt;p&gt;Just wanted to know whether this workaround is needed with &amp;nbsp;EF4.1 or is the root cause fixed?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Ravi Pathak&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10182352" width="1" height="1"&gt;</description></item><item><title>re: Cascade Delete and 1-to-1 (or 1-to-0..1) Relationships</title><link>http://blogs.msdn.com/b/dsimmons/archive/2010/02/06/cascade-delete-and-1-to-1-or-1-to-0-1-relationships.aspx#9980379</link><pubDate>Wed, 17 Mar 2010 13:55:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9980379</guid><dc:creator>mdejonge</dc:creator><description>&lt;p&gt;Hi Danny,&lt;/p&gt;
&lt;p&gt;Thanks a lot for sharing this information.&lt;/p&gt;
&lt;p&gt;For some reason the method EndIsPresentAndDeleted doesn't work for me. I had to change it into the following to make it work:&lt;/p&gt;
&lt;p&gt;private bool EndIsPresentAndDeleted(ObjectStateEntry entry, int index) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; var key = entry.OriginalValues[index];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; var stateEntry = ObjectStateManager.GetObjectStateEntries(EntityState.Deleted).FirstOrDefault(a =&amp;gt; a.EntityKey == key);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; return stateEntry != null;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Merijn&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9980379" width="1" height="1"&gt;</description></item><item><title>re: Cascade Delete and 1-to-1 (or 1-to-0..1) Relationships</title><link>http://blogs.msdn.com/b/dsimmons/archive/2010/02/06/cascade-delete-and-1-to-1-or-1-to-0-1-relationships.aspx#9963168</link><pubDate>Sun, 14 Feb 2010 00:19:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9963168</guid><dc:creator>Daniel Simmons - MSFT</dc:creator><description>&lt;p&gt;I'm glad that this has helped you. &amp;nbsp;Unfortunately it looks like this won't be resolved in a built-in way for .net 4--the full fix is somewhat involved and just too much for how late we are in the product cycle. &amp;nbsp;We'll get it for next time, though.&lt;/p&gt;
&lt;p&gt;- Danny&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9963168" width="1" height="1"&gt;</description></item><item><title>re: Cascade Delete and 1-to-1 (or 1-to-0..1) Relationships</title><link>http://blogs.msdn.com/b/dsimmons/archive/2010/02/06/cascade-delete-and-1-to-1-or-1-to-0-1-relationships.aspx#9963158</link><pubDate>Sat, 13 Feb 2010 23:23:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9963158</guid><dc:creator>RobCannon</dc:creator><description>&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
&lt;p&gt;I ran into this issue but was unable to solve it until now. &amp;nbsp;Also, I couldn't get this code to work directly either. &amp;nbsp;But I was able to hard code the relationship that was troublesome for me into the code and everything works now. &amp;nbsp;This was happening when I was trying to delete an entity via WCF Ria Services. &amp;nbsp;Hopefully the issue will be resolved with .NET 4.0.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9963158" width="1" height="1"&gt;</description></item></channel></rss>