<?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 : Question on Asynchronous Query</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Question on Asynchronous Query</description>
  <pubDate>Wed, 15 Apr 2026 09:04:06 -700</pubDate>
  <lastBuildDate>Wed, 03 Nov 2010 15:29:18 -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=2279</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>Question on Asynchronous Query : Without sample app it&amp;#039;s a...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9016#9016</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=485" rel="nofollow">jsobell</a><br /><strong>Subject:</strong> 2279<br /><strong>Posted:</strong> 03-Nov-2010 at 3:29pm<br /><br />Without&nbsp; sample app it's a bit tricky, but from what I can see...<br><br><font color="#0000ff" face="C&#111;nsolas" size="2"><font color="#0000ff" face="C&#111;nsolas" size="2"><font color="#0000ff" face="C&#111;nsolas" size="2">foreach</font></font></font><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"> (</font></font><font color="#2b91af" face="C&#111;nsolas" size="2"><font color="#2b91af" face="C&#111;nsolas" size="2"><font color="#2b91af" face="C&#111;nsolas" size="2">JobHistory</font></font></font><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"> jh </font></font><font color="#0000ff" face="C&#111;nsolas" size="2"><font color="#0000ff" face="C&#111;nsolas" size="2"><font color="#0000ff" face="C&#111;nsolas" size="2">in</font></font></font><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"> Member.JobHistories)</font></font><p><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">{</font></font></p><p><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">Jobs.Add(jh);</font></font></p><p><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">}</font></font></p><p><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">OnPropertyChanged(</font></font><font color="#a31515" face="C&#111;nsolas" size="2"><font color="#a31515" face="C&#111;nsolas" size="2"><font color="#a31515" face="C&#111;nsolas" size="2">"Jobs"</font></font></font><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">);</font></font></p>if Jobs is an ObservableCollection then you don't need to raise the PropertyChanged.<br>basically, it looks like you need to have something like this in the EmplSite setter:<br><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"><br>this.EmplSite.Employer</font></font></font></font>.PropertyChanged <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +=&nbsp;<span style="color: blue;">delegate</span>(<span style="color: blue;">object</span>&nbsp;sender,&nbsp;<span style="color: rgb43, 145, 175;">PropertyChangedEventArgs</span>&nbsp;o)<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { <span style="color: blue;">if</span>&nbsp;(o.PropertyName&nbsp;==&nbsp;<span style="color: rgb163, 21, 21;">"EmployerName"</span>)&nbsp;RaisePropertyChanged(<span style="color: rgb163, 21, 21;">"</span><span style="color: rgb163, 21, 21;">EmployerName</span><span style="color: rgb163, 21, 21;">"</span>); };<br><br>I think this will check for the contents of the nested object being changed, and reflect that change in your top level object.<br><br>You have to remember that your collection doesn't change when the objects are async received from the database, as DF is simply replacing an object into an existing one, not adding or removing objects from the collection.<br><br>Also, why do you have a Jobs collection? This is the same as <font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">Member.JobHistories</font></font> so you can bind straight to that collection.<br><br>In fact, you could bypass this whole problem by binding to <font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">Member.</font></font><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2"><font face="C&#111;nsolas" size="2">EmplSite.Employer.EmployerName </font></font></font></font>in your XAML code, so unless you have a good reason for replicating the property to the top object I would do it this way.<br><br>]]>
   </description>
   <pubDate>Wed, 03 Nov 2010 15:29:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9016#9016</guid>
  </item> 
  <item>
   <title>Question on Asynchronous Query : I am officially stumped at this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9011#9011</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=202" rel="nofollow">BillG</a><br /><strong>Subject:</strong> 2279<br /><strong>Posted:</strong> 03-Nov-2010 at 7:43am<br /><br />I am officially stumped at this point on where to raise the notifiedPropertyChanged on the JobHistory class in the MemberViewModel. In my MemberViewModel class I have the following: <DIV>&nbsp;</DIV><DIV>public Member currentMember&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; //represents the member currently being worked on in the view</DIV><DIV>public ObservableCollection&lt;JobHistory&gt; jobs {get; set;}&nbsp;&nbsp; //represents all the jobs that the member has had displayed in a grid</DIV><DIV>&nbsp;</DIV><DIV>Here is my retrieval of the member and their jobs.</DIV><DIV>&nbsp;</DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>public</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>void</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> GetMember()</P><DIV>{</DIV><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>string</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> ssn = memberToBeReteived.SocSecNo;</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> query = </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>from</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Member </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>in</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Mgr.Members.Include(</FONT></FONT><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas>"JobHistories"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>)</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>where</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Member.SocSecNo == ssn</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>select</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Member;</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> op = query.ExecuteAsync();</P><P>op.Completed += MemberQueryCompleted;</P><P>}</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>public</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>void</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> MemberQueryCompleted(</FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>Object</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> sender, </FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>EntityQueriedEventArgs</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&lt;</FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>Member</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&gt; e)</P><P>{</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> results = e.Results;</P><P>Member = results.First&lt;</FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>Member</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&gt;();</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>foreach</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> (</FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>JobHistory</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> jh </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>in</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Member.JobHistories)</P><P>{</P><P>Jobs.Add(jh);</P><P>}</P><P>OnPropertyChanged(</FONT></FONT><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas>"Jobs"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>I also have the following in the class</DIV><DIV>&nbsp;</DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>private</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>void</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Jobs_CollectionChanged(</FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>object</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> sender, </FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>NotifyCollectionChangedEventArgs</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> e)</P><P>{</P><P>OnPropertyChanged(</FONT></FONT><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas>"JobHistory"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>}</P><DIV></DIV><DIV>but that didn't seem to work. So I can't figure out why it is failing to bind to the following propery in the JobHistory class.</DIV><DIV>&nbsp;</DIV><DIV>public string EmployerName</DIV><DIV>{</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return this.EmplSite.Employer.EmployerName;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>and yet if I close the member record and open it the second time, it is displaying the employername in the grid.</DIV><DIV></FONT></FONT>&nbsp;</DIV></FONT></FONT></DIV>]]>
   </description>
   <pubDate>Wed, 03 Nov 2010 07:43:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9011#9011</guid>
  </item> 
  <item>
   <title>Question on Asynchronous Query : Bindings work by adding an event...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9007#9007</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=485" rel="nofollow">jsobell</a><br /><strong>Subject:</strong> 2279<br /><strong>Posted:</strong> 02-Nov-2010 at 7:58pm<br /><br />Bindings work by adding an event handler to the INotifyPropertyChanged event of any object they want to monitor.<br>In your case this event may be firing against the Employer object, but your EmployerName property is on a different object, so you will have to raise the NotifyPropertyChanged for the JobHistory object yourself.<br>I often do this by intercepting the Setter of the Employer object, add an event handler programatically that checks for parameter "EmployerName" on the nested object being changed, and in turn raise the change event for "EmployerName" in the JobHistory object.<br>It works the second time because the object is already updated, so your interface is not reacting to the RaisePropertyChanged, but to the fact it is reading values for its initial bind.<br>This is always an issue when you have properties reading values from nested objects, and it becomes your responsibility to relay the change events, as it's clearly impractical for the system to bubble property change events up entire trees, and .NET has no awareness of the dependency a property definition has on any code implementation it contains.<br><br>These issues have been present in every aspect of .NET's property event handling, but has become far more high-profile as lazy loading with UI level binding in Silverlight and WPF has become more common.&nbsp; In the past we would often see cases of people 'rebinding' or 'refreshing' their screens to reflect changes to these nested objects, rather than addressing the real issue that you have found.<br><br>Cheers,<br>&nbsp;Jason<br>]]>
   </description>
   <pubDate>Tue, 02 Nov 2010 19:58:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9007#9007</guid>
  </item> 
  <item>
   <title>Question on Asynchronous Query : Ok if I get out of that record...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9004#9004</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=202" rel="nofollow">BillG</a><br /><strong>Subject:</strong> 2279<br /><strong>Posted:</strong> 02-Nov-2010 at 1:05pm<br /><br />Ok if I get out of that record and then go back in, then the names appear. But not on the first time and not even if I sit and wait on the open record.]]>
   </description>
   <pubDate>Tue, 02 Nov 2010 13:05:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9004#9004</guid>
  </item> 
  <item>
   <title>Question on Asynchronous Query : When the user clicks on a row...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9003#9003</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=202" rel="nofollow">BillG</a><br /><strong>Subject:</strong> 2279<br /><strong>Posted:</strong> 02-Nov-2010 at 12:31pm<br /><br />When the user clicks on a row in the MemberListView screen, I get the selectedItem and pass it to my model. In my model for the detailscreen, I Fetch the individual member selected and .Include his/her job histories, dues records. In the callback completed method I loop through the job histories and add them to a ObservableCollection Jobs. This displays them in the grid on the member form. That works fine. What doesn't work is that in my Domain Model class for JobHistory I have the following to display the Employer Name<DIV>&nbsp;</DIV><DIV>public string EmployerName</DIV><DIV>{</DIV><DIV>&nbsp;&nbsp;&nbsp; get{</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return EmplSite.Employer.EmployerName;</DIV><DIV>&nbsp;&nbsp;&nbsp; }</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>public string JobName</DIV><DIV>{</DIV><DIV>&nbsp;&nbsp;&nbsp; get{</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return EmplSite.JobName;</DIV><DIV>&nbsp;&nbsp;&nbsp; }</DIV><DIV>}</DIV><DIV>&nbsp;</DIV><DIV>These are not displaying in the datagrid which uses the ItemsSource="{Binding Jobs}" which is the collection of JobHistory records for that member. How do I get the above to appear. I do the following for the binding&nbsp;&nbsp;&nbsp; Binding="{Binding EmployerName, Mode = OneWay}" and Binding="{Binding JobName, Mode = OneWay}"</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Tue, 02 Nov 2010 12:31:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2279&amp;PID=9003#9003</guid>
  </item> 
 </channel>
</rss>