<?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>A helper to easily set up change notifications in Entity Framework</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx</link><description>When you use Entity Framework, you can perform Insert/Update/Delete operations on your entities, and you eventually call ObjectContext.SaveChanges() to actually make it all happen.&amp;#160; The call to SaveChanges() is either explicit, or can happen implicitly</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: A helper to easily set up change notifications in Entity Framework</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx#9303932</link><pubDate>Sat, 10 Jan 2009 14:37:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9303932</guid><dc:creator>Michael</dc:creator><description>&lt;p&gt;Thanks for this David but it does'nt seem to work in a situation where the only change is to a foreign key (drop-down). &lt;/p&gt;
&lt;p&gt;What I'm trying to achieve is to check for a foreign key change and then validate other properties of the same entity. &lt;/p&gt;
&lt;p&gt;Any thoughts appreciated !&lt;/p&gt;
</description></item><item><title>Link Listing - January 10, 2009</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx#9304148</link><pubDate>Sat, 10 Jan 2009 17:32:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9304148</guid><dc:creator>Christopher Steen</dc:creator><description>&lt;p&gt;Code Camps First New Hampshire Code Camp on February 28th [Via: cbowen ] Link Collections Interesting...&lt;/p&gt;
</description></item><item><title>re: A helper to easily set up change notifications in Entity Framework</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx#9304388</link><pubDate>Sat, 10 Jan 2009 20:28:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9304388</guid><dc:creator>davidebb</dc:creator><description>&lt;p&gt;Michael, seems you're right, as apparently EF treats those quite differently. In ProcessObjectStateEntries, if have a line that checks 'if (entry.Entity == null)', and in the relationship case, it is indeed null. Instead, the ObjectStateEntry is a RelationshipEntry which contains info about just the relationship.&lt;/p&gt;
&lt;p&gt;I need to talk to the EF folks to understand the best way to deal with this.&lt;/p&gt;
</description></item><item><title>re: A helper to easily set up change notifications in Entity Framework</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx#9304462</link><pubDate>Sat, 10 Jan 2009 21:16:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9304462</guid><dc:creator>Michael</dc:creator><description>&lt;p&gt;I'm one step ahead of you, David :-) &lt;/p&gt;
&lt;p&gt;If you check the 'IsRelationship' property of the ObjectStateEntry and it's true you can get the key and hence the type of the object from objectStateEntry.CurrentValues[1] and retrieve the object from a new instance of the Data Entities by using the GetObjectByKey method. &lt;/p&gt;
&lt;p&gt;The problem I'm now having is that the foreign key references in the NorthwindEntities.Inserting() method of the partial classes seem to contain the original values. Getting very frustrated now !&lt;/p&gt;
</description></item><item><title>re: A helper to easily set up change notifications in Entity Framework</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx#9304514</link><pubDate>Sat, 10 Jan 2009 21:57:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9304514</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;I think i'd want to put an eternal breakpoint on the &amp;quot;entry.AcceptChanges()&amp;quot; line :)&lt;/p&gt;
</description></item><item><title>re: A helper to easily set up change notifications in Entity Framework</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx#9305504</link><pubDate>Sun, 11 Jan 2009 10:54:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9305504</guid><dc:creator>davidebb</dc:creator><description>&lt;p&gt;Hi Michael,&lt;/p&gt;
&lt;p&gt;I checked with someone from the Entity Framework team, and they confirm that getting this helper to work well on FKs would be tricky.&lt;/p&gt;
&lt;p&gt;In their words: &amp;quot;There is no simple way to drill into the relationship state entry (or, more likely, pair of relationship state entries, one deleted and one added) and turn it into an update. It is possible, but quite awkward. You need to match the entity key in the relationship state entry to a particular entity. In the EDM, the relationship is not part of the entity. That’s why changes to the relationship are not reflected in the entity state entry.&amp;quot;&lt;/p&gt;
&lt;p&gt;At this point, this becomes more of an EF question than something specific to this helper, and I'd suggest following up where the experts are: &lt;a rel="nofollow" target="_new" href="http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/threads/"&gt;http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/threads/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Dynamic Data FAQ</title><link>http://blogs.msdn.com/davidebb/archive/2009/01/09/a-helper-to-easily-set-up-change-notifications-in-entity-framework.aspx#9432082</link><pubDate>Wed, 18 Feb 2009 21:35:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9432082</guid><dc:creator>Ricka on Dynamic Data</dc:creator><description>&lt;p&gt;Please post corrections/new submissions to the Dynamic Data Forum . Put FAQ Submission/Correction in&lt;/p&gt;
</description></item></channel></rss>