SilverlightShow: WCF RIA Services Part 2: Querying Data Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) Re: WCF RIA Services Part 2: Querying Data <p>Hi Pay,</p> <p>Not sure why you would be bothering with VS 11 Beta when it is released, but the simple fact is that when an author puts out an article / book / publication, it is impossible to expect that their sample code will work correctly with future releases of the tools that they don't have access to at the time, especially a beta release of a future product. </p> <p>That being said, the samples open and run fine for me in Visual Studio 2012. You do get some conversion warnings, but those are just because it has to update some references when it brings it into the VS 2012 environment.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment8631 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 23 Nov 2012 15:54:25 GMT Re: WCF RIA Services Part 2: Querying Data <p>Hi, Brian.</p> <p>I am embarrassed to reveal my true level of ignorance, but what the heck. I read with enthusiasm your first and second article on WCF-RIA services. They were extremely helpful, so I thank you sincerely. I also downloaded both projects, but I can get neither to run on my system. I'm using VS2011 Beta. When I try to run either project, I receive the following error message:</p> <p>The Silverlight project you are about to debug uses WCF-RIA services. WCF RIA services will fail unless the Silverlight project is hosted in and launched from the same web project that contains the WCF RIA services. Do you want to debug anyway.</p> <p>If I click on Yes, I get a run-time error in the browser, and I can go no farther.</p> <p>This question is probably out of context for your articles, so if you want to simply point me somewhere, that would be thoroughly acceptable to me. Also, if you want to *ignore* such a baby question, that too is thoroughly acceptable! :-)</p> <p>Thanks for your attention to this matter.</p> <p>Pay</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment8626 payohtee http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 23 Nov 2012 02:39:45 GMT Re: WCF RIA Services Part 2: Querying Data <p>First off if you want to display related item, you would not query the personnel and departments collection separately, you would need to make sure that each personnel record returns its related departments. You would do this with an Include() statement on your EF query and an [Include] attribute on the Departments collection property on the Personnel class.</p> <p>Second, the data binding for the details form would need to get the SelectedItem.Departments collection off the currently selected Personnel item in the data grid.</p> <p>Take a closer look at the master details scenarios in my articles and you will see examples just like this.</p> <p><br /> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment8381 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 16 Aug 2012 06:14:24 GMT Re: WCF RIA Services Part 2: Querying Data <p>There are two tables in my domaincontext 1. Personnel 2.Department, Personnel has foreign key to Department.</p> <p>In the ViewMode, I have the following code</p> <p>        public IEnumerable<Personnel> Personnels { get; set; }<br />         public IEnumerable<Department> Departments { get; set; }</p> <p>        public HomeViewModel()<br />         {<br />             Personnels = _context.Personnels;<br />             Departments = _context.Departments;<br />             if (!DesignerProperties.IsInDesignTool)<br />             {<br />                 _context.Load(_context.GetPersonnelsQuery());<br />                 _context.Load(_context.GetDepartmentsQuery());                <br />             }<br />         }</p> <p>In the View, my XAML is</p> <p><sdk:DataGrid AutoGenerateColumns="True" Name="dataGrid1" ItemsSource="{Binding Path=Personnels, Mode=TwoWay}" /></p> <p><df:DataForm x:Name="myDF" CurrentItem="{Binding SelectedItem, ElementName=dataGrid1}"><br />                     <df:DataForm.EditTemplate><br />                         <DataTemplate><br />                             <StackPanel><br /> ...<br />                                    <df:DataField Label="Department"><br />                                         <ComboBox ItemsSource="{Binding Departments, Mode=TwoWay}" /><br />                                 </df:DataField><br />                            </StackPanel><br />                         </DataTemplate><br />                     </df:DataForm.EditTemplate><br />                 </df:DataForm></p> <p>But there is no data populated in the combobox. Could you please help. Thanks!</p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment8380 haiyun592 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 16 Aug 2012 03:29:27 GMT Re: WCF RIA Services Part 2: Querying Data Retrieve the collection through your domain context, expose a property from your view model like I have done in the samples that surfaces the collection from the domain context for binding from the view. Then bind your ComboBox ItemsSource to that property. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7982 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sat, 21 Apr 2012 20:52:24 GMT Re: WCF RIA Services Part 2: Querying Data Brian, I am trying to use a ComboBox in a Data Form to display company department names in my RIA application,  could you please tell me how to use it. Thanks! http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7981 haiyun592 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sat, 21 Apr 2012 20:40:34 GMT Re: WCF RIA Services Part 2: Querying Data <p>hi Brain,</p> <p>is there a way where we can catch up on skype.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7483 manjerekarrao http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 02 Feb 2012 15:21:22 GMT Re: WCF RIA Services Part 2: Querying Data <p>Brian,</p> <p>Looks like I needed to have the .Include("ChildEntities") in the domain service class to fix this one. Threw me off when I didn't have that but it still worked 95% of the time?</p> <p>Anyway, hoping it's reliable now.</p> <p>Thanks.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7443 stratdaz http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 27 Jan 2012 00:49:19 GMT Re: WCF RIA Services Part 2: Querying Data <p>Manjerekar, Did you add the connection string to the web.config?</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7440 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 26 Jan 2012 02:06:27 GMT Re: WCF RIA Services Part 2: Querying Data <p>Hi Brian,</p> <p>i created my TaskModel.edmx in a separate class library and not in TaskManager.Web server </p> <p>project.</p> <p>when i try adding TasksDomainService in the TaskManager.Web project, i see that the </p> <p>'Generate associated classes for metadata' option is disabled. I still went ahead and added </p> <p>the TasksDomainService. Rebuilt the complete solution and when i finally executed the </p> <p>application i get this error.....</p> <p>System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed </p> <p>for query 'GetTasks'. The remote server returned an error: NotFound. ---> </p> <p>System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. </p> <p>---> System.Net.WebException: The remote server returned an error: NotFound. ---> </p> <p>System.Net.WebException: The remote server returned an error: NotFound.<br />    at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult </p> <p>asyncResult)<br />    at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4</p> <p>(Object sendState)<br />    at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)<br />    --- End of inner exception stack trace ---<br />    at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object </p> <p>state)<br />    at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)<br />    at </p> <p>System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.</p> <p>CompleteGetResponse(IAsyncResult result)<br />    --- End of inner exception stack trace ---<br />    at System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult </p> <p>asyncResult)<br />    at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult </p> <p>asyncResult)<br />    at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult </p> <p>asyncResult)<br />    --- End of inner exception stack trace ---</p> <p> </p> <p>Request you to pls help me in this issue.</p> <p> </p> <p>Thank you</p> <p>Manjerekar</p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7438 manjerekarrao http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 25 Jan 2012 14:30:06 GMT Re: WCF RIA Services Part 2: Querying Data <p>stratdaz,</p> <p>I'm not sure what would cause the behavior you describe. If the child entity collection is marked on the server side entities with an [Include] attribute, and the Entity Framework query loads the entities with an .Include() call, then you can fire up Fiddler and see that the child entities are returned with the parent entites in a single request to the server. So you should be able to reliably use the child collection property (not member variable) on the Parent entities returned from the Load call in the completed handler and the child entities should be available immediately with no delay.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7410 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 15 Jan 2012 17:36:35 GMT Re: WCF RIA Services Part 2: Querying Data <p>Oops, please ignore the line ...</p> <p><em>"Here is an example where "Clients" and "ClientOrders" are ViewModel properties ..."</em></p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7386 stratdaz http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 11 Jan 2012 07:58:36 GMT Re: WCF RIA Services Part 2: Querying Data <p>Oops, please ignore the line ...</p> <p><em>"Here is an example where "Clients" and "ClientOrders" are ViewModel properties ..."</em></p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7385 stratdaz http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 11 Jan 2012 07:16:37 GMT Re: WCF RIA Services Part 2: Querying Data <p>Oops, please ignore the line ...</p> <p><em>"Here is an example where "Clients" and "ClientOrders" are ViewModel properties ..."</em></p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7384 stratdaz http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 11 Jan 2012 05:17:52 GMT Re: WCF RIA Services Part 2: Querying Data <p>I need to process associated (child) entites from a query. Problem is the child entities are not always populated by the time the callback is fired. </p> <p>Here is an example where "Clients" and "ClientOrders" are ViewModel properties ...</p> <p>private void GetClient()<br />         {<br />             _domainContext.Load(_domainContext.GetClientsQuery(), lo =><br />             {<br />                 Client client = lo.Entities.FirstOrDefault(c => c.ClientId == 1);<br />                 int orderCount = client.ClientOrders.Count();<br />             }, null);<br />         }</p> <p>The first time I run this query for a client (say client 1) "orderCount" is nearly always 0. When I select another client and then reselect client 1 "orderCount" has the correct number of client orders.</p> <p>It seems the callback is triggered when the client entity query has completed and does not wait until all associated entities are populated.</p> <p>Is there an event related to the population of the child entity collection that I can hook into?</p> <p>Thanks.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7383 stratdaz http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 11 Jan 2012 05:15:55 GMT Re: WCF RIA Services Part 2: Querying Data haiyun592, please see my answer to your similar question in Part 1 of the series. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7382 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 10 Jan 2012 15:51:48 GMT Re: WCF RIA Services Part 2: Querying Data <p>Please Help,</p> <p>Instead of displaying the returned data in a data grid, how can I get a single value from the domain context and assign the value to a variable?</p> <p> Thanks!</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment7379 haiyun592 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Mon, 09 Jan 2012 21:08:44 GMT Re: WCF RIA Services Part 2: Querying Data <p>Not sure how to help with that since there is no main.aspx in the solution. You need to download, unzip, open the solution, build, and make sure the TaskManagerTestPage.aspx is set as the start page for the web app. Then do a debug run with the web app as the startup project. If you have problems at that point, give me some more specifics and I can probably help. I would recommend you read a little further into the series, because I talk about debugging and handling errors in several of the upcoming articles in the series.</p> <p>Brian</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6504 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 11 Sep 2011 14:10:12 GMT Re: WCF RIA Services Part 2: Querying Data <p>I downloaded the file and opened it in VS2010</p> <p>I got an error eg on main.aspx</p> <span style="font-family: consolas; color: #0000ff; font-size: 13px;"> <p><</p> <p> </p> <p> </p> </span> <p><span style="font-family: consolas; color: #a31515; font-size: 13px;">my</span><span style="font-family: consolas; color: #0000ff; font-size: 13px;">:</span><span style="font-family: consolas; color: #a31515; font-size: 13px;">TasksDomainContext</span><span style="font-family: consolas; color: #0000ff; font-size: 13px;"> /></span></p> <p><span style="font-family: consolas; color: #0000ff; font-size: 13px;">was not found. make sure you are not missing an assembly reference.</span></p> <p>help </p> <p> </p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6503 eilering http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 11 Sep 2011 13:46:10 GMT Re: WCF RIA Services Part 2: Querying Data Most likely you have your server project set to the .NET 4 Client Profile in the project application settings, need to change it to be full .NET 4. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6447 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 21 Aug 2011 23:24:20 GMT Re: WCF RIA Services Part 2: Querying Data <p>while executing the line:</p> <p>LoadOperation<Task> loadOp = context.Load(query); </p> <p>following exception is encountered:</p> <p>Could not load file or assembly 'System.ServiceModel.Web, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. Invalid assembly file format. (Exception from HRESULT: 0x8013141D)</p> <p>Please let me know what is this issue and how to resolve it? </p> <p>Thanks</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6446 furqan.safdar http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sat, 20 Aug 2011 12:42:23 GMT Re: WCF RIA Services Part 2: Querying Data Please read further into the series, this is covered in parts 3 and 4. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6437 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Mon, 15 Aug 2011 14:00:46 GMT Re: WCF RIA Services Part 2: Querying Data Thank you for your response.  I am one week into coding my first siverlight app.  Could you provide a sample procedure to show how to handle the callback? http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6436 jj2011 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Mon, 15 Aug 2011 06:32:51 GMT Re: WCF RIA Services Part 2: Querying Data Load is an asynchronous operation, you have to handle a callback or the Completed event to see the resulting entities. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6435 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 14 Aug 2011 16:59:52 GMT Re: WCF RIA Services Part 2: Querying Data <p>I've tried following your example, but I cannot get my query to work.  When a user selects an item in the grid, I want to take they key value selected and use it to query for the detail data.  I cannot bind this data because the resulting item coming from the server is rtf text to a richtext control.  Here is a sample of my code:</p> <span style="font-family: consolas; font-size: 13px;"> <p> </p> <p> </p> </span> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">vResourceName</span><span style="font-family: consolas; font-size: 13px;"> selItem = (</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">vResourceName</span>)vResourceNameDataGrid.SelectedItem; </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">SmartGridContext</span><span style="font-family: consolas; font-size: 13px;"> context = </span><span style="font-family: consolas; color: #0000ff; font-size: 13px;">new</span><span style="font-family: consolas; font-size: 13px;"> </span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">SmartGridContext</span>(); </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">EntityQuery</span><span style="font-family: consolas; font-size: 13px;"><</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">ResourceItem</span>> query = context.GetResourceItemsByIDQuery(selItem.ResourceID); </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">LoadOperation</span><span style="font-family: consolas; font-size: 13px;"><</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">ResourceItem</span>> loadOp = context.Load(query); </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #0000ff; font-size: 13px;">if</span> (loadOp.Entities.Count() > 0) </p> <p> </p> <p>{</p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">ResourceItem</span><span style="font-family: consolas; font-size: 13px;"> NewResource = loadOp.Entities.LastOrDefault();</span></p> <p><span style="font-family: consolas; font-size: 13px;">}</span></p> <p>The Entities count is always 0, indicating no data was returned.  I' stuck. </p> <p> </p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6434 jj2011 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 14 Aug 2011 08:56:35 GMT Re: WCF RIA Services Part 2: Querying Data <p>I've tried following your example, but I cannot get my query to work.  When a user selects an item in the grid, I want to take they key value selected and use it to query for the detail data.  I cannot bind this data because the resulting item coming from the server is rtf text to a richtext control.  Here is a sample of my code:</p> <span style="font-family: consolas; font-size: 13px;"> <p> </p> <p> </p> </span> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">vResourceName</span><span style="font-family: consolas; font-size: 13px;"> selItem = (</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">vResourceName</span>)vResourceNameDataGrid.SelectedItem; </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">SmartGridContext</span><span style="font-family: consolas; font-size: 13px;"> context = </span><span style="font-family: consolas; color: #0000ff; font-size: 13px;">new</span><span style="font-family: consolas; font-size: 13px;"> </span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">SmartGridContext</span>(); </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">EntityQuery</span><span style="font-family: consolas; font-size: 13px;"><</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">ResourceItem</span>> query = context.GetResourceItemsByIDQuery(selItem.ResourceID); </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">LoadOperation</span><span style="font-family: consolas; font-size: 13px;"><</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">ResourceItem</span>> loadOp = context.Load(query); </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #0000ff; font-size: 13px;">if</span> (loadOp.Entities.Count() > 0) </p> <p> </p> <p>{</p> <p> </p> <p> </p> <p> </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">ResourceItem</span><span style="font-family: consolas; font-size: 13px;"> NewResource = loadOp.Entities.LastOrDefault();</span></p> <p><span style="font-family: consolas; font-size: 13px;">}</span></p> <p>The Entities count is always 0, indicating no data was returned.  I' stuck. </p> <p> </p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6433 jj2011 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 14 Aug 2011 08:56:33 GMT Re: WCF RIA Services Part 2: Querying Data When your context loads a collection of a given entity type, it caches them and just refreshes them if subsequent loads happen. So once you have retrieved both of them with the other query, the second query getting just one just makes sure that entity is in the cache as is current. If you want to just get the one you can either new up a new domain context and execute the query with it, or Clear() the entity collection on the one you are using before the call to Load with GetPlantaByIdQuery so that only that one will be in the collection after the async load completes. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6279 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 10 Jun 2011 03:38:53 GMT Re: WCF RIA Services Part 2: Querying Data <p>But I don't want to bind directly to some control in the design. </p> <p>My entity that I want is called Planta. And what I need is to manipulate a Planta entity, not an EntitySet<Planta>. </p> <p>For that I'm making:</p> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;">_Context.Load(_Context.GetPlantaByIdQuery(<span style="color: #2b91af;">Int32</span>.Parse(plantaEscolhida))); <span style="color: #2b91af;">EntitySet</span><<span style="color: #2b91af;">Planta</span>> p = _Context.Plantas; <pre style="font-family: consolas; background: white; color: black; font-size: 13px;"><span style="color: blue;">foreach</span> (<span style="color: #2b91af;">Planta</span> pl <span style="color: blue;">in</span> p)             {                 <span style="color: #2b91af;">MessageBox</span>.Show(pl.id_planta + <span style="color: #a31515;">" "</span> + pl.nome + <span style="color: #a31515;">"\n"</span>);                 <span style="color: #2b91af;">Planta</span> plantaSeleccionada = pl;             }</pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;"> </pre> (I've tried with the definition of p before calling the load and the result was the same).</pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;">I'm showing in a MessageBox to see how many <em>Plantas</em> there is in the entity. </pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;">For testing purposes, I have two Plantas in the database.</pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;">In the constructor of the class I load all the <em>Plantas</em>, because I need them: </pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;"><pre style="font-family: consolas; background: white; color: black; font-size: 13px;"><span style="color: blue;">public</span> ViewerViewModel()         {             <span style="color: blue;">this</span>.timer.Duration = <span style="color: #2b91af;">TimeSpan</span>.FromSeconds(1);             <span style="color: blue;">this</span>.timer.Completed += <span style="color: blue;">new</span> <span style="color: #2b91af;">EventHandler</span>(timer_Tick);             _Context = <span style="color: blue;">new</span> <span style="color: #2b91af;">TesteDomainContext</span>();             _Context.Load(_Context.GetPlantasQuery());         }</pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;"> </pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;">So I don't know if the previous load is anything to do with the other load.</pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;"> </pre> <pre style="font-family: consolas; background: white; color: black; font-size: 13px;">Btw, I'm using SL5 with Ria Services SP2.</pre> </pre> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6277 AfonsoGomes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 09 Jun 2011 17:25:28 GMT Re: WCF RIA Services Part 2: Querying Data <p>Afonso,</p> <p>You get one query method on the domain context for each query method you expose from the domain service. The one mappiing to GetTask is:</p> <pre style="background: white; color: black; font-family: consolas;"><span style="color: #2b91af;">EntityQuery</span><<span style="color: #2b91af;">Task</span>> GetTaskQuery(<span style="color: blue;">int</span> taskId) </pre> <pre style="background: white; color: black; font-family: consolas;">So similar to getting all tasks, you would pass that query object to the Load method:</pre> <pre style="background: white; color: black; font-family: consolas;">_TasksDomainContext.Load(GetTaskQuery(taskId));</pre> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6266 brian.noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 09 Jun 2011 03:07:43 GMT Re: WCF RIA Services Part 2: Querying Data <p>I'm trying to get the retrieved single entity, but i don't know how to do it in the client. How can i call the method GetTask(int TaskID) and receive the Task in the client?</p> <p> </p> <p>Thanks,</p> <p>Afonso Gomes</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment6263 AfonsoGomes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 08 Jun 2011 18:04:28 GMT RE: WCF RIA Services Part 2: Querying Data Alex: Does the grid load with four rows when you first run the app? If not, then it is probably a connection string problem. Part 8 in this series talks about debugging RIA Services apps. If you are running SQL Express, you will have to modify the connection string in the web.config file of the hosting site to point to your named instance of SQL Express (.\SQLExpress by default) instead of the default server it points to in the download code (server=. should be switched to server=.\SQLEXPRESS). http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment5407 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sun, 30 Jan 2011 22:32:12 GMT RE: WCF RIA Services Part 2: Querying Data sorry, maybe i've missed something, but then i set dates and push the "Search By Date" nothing happen, i downloaded finished code of this article and run it on VWD 2010 Express and SQL Server 2005 Express with TaskManager DataBase on it. Use SL4, WCF RIA Services Toolkit December 2010. What can i do wrong? http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment5398 Alex http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 27 Jan 2011 19:02:02 GMT RE: WCF RIA Services Part 2: Querying Data Mark, [Include] attribute works for single object (i.e. Parent) references as well. But your entity framework query is not loading through the Item association. However, in general I have found it problematic to load up entire object graphs with eager loading in EF. Generally for those scenarios I find it easier to give up on the deferred execution, define my method as an IEnumerable<T> instead of IQueryable<T>, and then I can progressively load up all the related objects myself. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment5213 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sat, 01 Jan 2011 20:26:54 GMT RE: WCF RIA Services Part 2: Querying Data <p>brian</p> <p>or might it be betterto use a view / stored procedure ??</p> <p>m</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment5208 markse http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sat, 01 Jan 2011 13:21:44 GMT RE: WCF RIA Services Part 2: Querying Data <p>Brian</p> <p>thx for the quick response..... oops - no i hadn't. </p> <p>now works for the first couple of levels </p> <p>i.e. i can now eager load the PromoGroupDetails and the PromoItemDetails when loading the Header Details.</p> <span style="font-size: 13px; color: #0000ff; font-family: consolas;"><span style="font-size: 13px; color: #0000ff; font-family: consolas;"><span style="font-size: 13px; color: #0000ff; font-family: consolas;"> <p>return</p> </span> <p> </p> </span> <p> </p> </span> <p><span style="font-size: 13px; font-family: consolas;"></span><span style="font-size: 13px; color: #0000ff; font-family: consolas;">this</span><span style="font-size: 13px; font-family: consolas;">.ObjectContext.PromoHeaderDetails.Include(</span><span style="font-size: 13px; color: #a31515; font-family: consolas;">"PromoGroupDetails.PromoItemDetails"</span><span style="font-size: 13px; font-family: consolas;">);</span></p> <p><span style="font-size: 13px; font-family: consolas;"><span style="font-size: 13px; font-family: consolas;">but i get an error when i try and load the Item details (there is one of these for each PromoItemDetails record i.e. a 1 <-> 1 relationship). as far as i can see, problem is due to there being only one Item per ItemDetails record and therefore the [Include] attibute wont work as it works on an ObjectSet rather than an individual entity <p> </p> <p>is there a way around this to "bulk load" the item details i - or do i need to loop around the resultset i have got an then read the item record directly (by id).........</p> </span> <p> </p> </span></p> <p> </p> <p> </p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment5207 markse http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sat, 01 Jan 2011 13:19:45 GMT RE: WCF RIA Services Part 2: Querying Data MarkSe,Did you add the [Include] attributes in the metadata "buddy" classes for the entity relations? http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment5203 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 31 Dec 2010 15:47:46 GMT RE: WCF RIA Services Part 2: Querying Data <p>Brian,</p> <p>i am trying to get Eager loading working - environment is silverlight 4 / .net 4.</p> <div class="body"> <p>basically, table structure is</p> <p>PromoHeader has 0 to many PromoGroups</p> <p>PromoGroup has 0 to many PromoItems</p> <p>PromoItem has 1 Item</p> <p>Item has several lookups</p> <p>Code in ViewModel (based on briannoyes.net/2010/06/29/QueryingWCFRIAServicesAndHandlingAsyncResults.aspx)</p> <pre> public PromoBuilderReviewPromoItemsVM() { PageItems = new ObservableCollection<PromoHeaderDetail>(); Hydra2DomainContext hydraContext = new Hydra2DomainContext(); EntityQuery<PromoHeaderDetail> phdQuery = hydraContext.GetPromoHeaderDetailsAllDetailsQuery(); Action<LoadOperation<PromoHeaderDetail>> completeProcessing = delegate(LoadOperation<PromoHeaderDetail> loadOp) { if (!loadOp.HasError) { ProcessTasks(loadOp.Entities); } else { LogAndNotify(loadOp.Error); } }; LoadOperation<PromoHeaderDetail> loadOperation = hydraContext.Load(phdQuery.Where(t => t.StartDate > DateTime.Parse("2011-01-01 00:00:00")), completeProcessing, null); } private void ProcessTasks(IEnumerable<PromoHeaderDetail> entities) { var ii = 0; foreach (var promoHeader in entities) { ii++; PageItems.Add((PromoHeaderDetail)promoHeader); foreach (var promoGroup in promoHeader.PromoGroupDetails) { foreach (var promoItem in promoGroup.PromoItemDetails) { PageItems2.Add((Item)promoItem.Item); } } } } private void LogAndNotify(Exception error) { // Log the error and notify user if appropriate }</pre> <p>and in the Domain Service</p> <pre> public IQueryable<PromoHeaderDetail> GetPromoHeaderDetailsAllDetails() { this.ObjectContext.ContextOptions.LazyLoadingEnabled = false; return this.ObjectContext.PromoHeaderDetails.Include("PromoGroupDetails.PromoItemDetails.Item.Lookup"); } </pre> <pre>when i run this code - and review using SQL profiler, the query is reading all of the tables and including the "sub-tables".</pre> <pre>however, in the code, while query is returning correct number of PromoHeader records - none of them have any PromoGroup records </pre> <pre>or PromoItems that could be seen in the T-SQL query in profiler.</pre> <pre>so - the correct data in being read - but not returned....</pre> <pre>thx</pre> <pre>(and a happy New Year)</pre> <pre>ps. have also posted this on MSDN forum...</pre> <pre> </pre> </div> <p><em></em> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment5202 MarkSe http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 31 Dec 2010 15:04:00 GMT RE: WCF RIA Services Part 2: Querying Data Silver123: Just remove your Select and return an IQueryable. Obviously if you filter to a single ID, you are only going to return one object. Don't filter. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4883 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 17 Nov 2010 13:56:55 GMT RE: WCF RIA Services Part 2: Querying Data <p>Hi,</p> <p>following is the code in my domain service for geting list of cadreids from cadre_master table</p> <span style="font-family: consolas; font-size: 13px;"></span> <p><span style="font-family: consolas; color: #0000ff; font-size: 13px;">public</span><span style="font-family: consolas; font-size: 13px;"> </span><span style="font-family: consolas; color: #0000ff; font-size: 13px;">int</span><span style="font-family: consolas; font-size: 13px;"> GetCadreID()<br /> {<br />   </span><span style="font-family: consolas; color: #0000ff; font-size: 13px;">return</span><span style="font-family: consolas; font-size: 13px;"> </span><span style="font-family: consolas; color: #0000ff; font-size: 13px;">this</span><span style="font-family: consolas; font-size: 13px;">.ObjectContext.Master_Cadre.Select(t => t.Cadre_ID);<br /> } <p>but i want to return all cadreids so what would be the return type of the function.</p> <p>i have tried: </p> <p><span style="font-family: consolas; color: #2b91af; font-size: 13px;">IQueryable</span><span style="font-family: consolas; font-size: 13px;"><</span><span style="font-family: consolas; color: #2b91af; font-size: 13px;">Master_Cadre</span><span style="font-family: consolas; font-size: 13px;">>, <span style="font-family: consolas; color: #2b91af; font-size: 13px;">IEnumerable<></span></span></p> <p>but no success.</p> <p>Please help..</p> </span></p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4882 Silver123 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 17 Nov 2010 12:42:27 GMT RE: WCF RIA Services Part 2: Querying Data <p>Steve,</p> <p>Once you have done a Load, the returned entities are cached in the exposed collection on the DomainContext, i.e. myContext.MyLookupValues. You can just re-bind to that collection anywhere you need it. For those usage scenarios (i.e. potentially many views that depend on those values), I would move my DomainContext out to a service (in process service based on the service locator pattern), do the Load once there, and just expose the collection owned by the DataContext via a collection property or method on the service that I can grab and bind to from many UIs.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4873 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 17 Nov 2010 00:07:57 GMT RE: WCF RIA Services Part 2: Querying Data How to cache queries - ie. lookup tables ? http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4872 Steve http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 16 Nov 2010 23:03:39 GMT RE: WCF RIA Services Part 2: Querying Data Those would just be separate queries you would need to expose from your domain service to pull down the list of Employees and the list of Cadres. Then you would have two more Load calls with no filter criteria on them through the domain context. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4868 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 16 Nov 2010 15:08:11 GMT RE: WCF RIA Services Part 2: Querying Data <p>In the above example u have used textboxes for criteria.</p> <p>If i want to use comboboxes and fill those combo boxes with values from master table..what would be the code for that.</p> <p>Also in that case what change will be in the above code that u have given.</p> <p>How to retrive values from comboboxes and use it in query.</p> <p>Thanks!!</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4867 Silver123 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 16 Nov 2010 14:53:47 GMT RE: WCF RIA Services Part 2: Querying Data <p>Assuming that your Emp_Trans table has foreign key columns empid and cadreid in it, you would do the following:</p> <p>- define a GetEmployeeTransactions method on your domain service that returns ObjectContext.Emp_Trans</p> <p>- then the code in your domain context would look like</p> <p>EntityQuery<EmpTrans> query = _EmployeesDomainContext.GetEmployeeTransactionsQuery();</p> <p>_EmployeesDomainContext.Load(query.Where(emp=>emp.empid = selectedEmpId && emp.cadreid == selectedCadreId);</p> <p>When load completed, you should have your filtered data. In this case you don't even need the Include on the object context or the metadata class if you are just returning a single row since the filtering actually happens at the database.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4865 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 16 Nov 2010 11:50:38 GMT RE: WCF RIA Services Part 2: Querying Data <p>Thanks for your reply!!</p> <p>Could you please explain it by giving any example (Require the code).</p> <p>My scenareo is as following:</p> <p>i have three comboboxes </p> <p>1)empid  -> empids should be loaded from master table say Employee_Master</p> <p>2)cadreid ->cadreid shud be loaded from master table say Cadre_Master</p> <p>there will be one Search button and datagrid </p> <p>On  selecting empid and cadreid from combo box and Clicking on search button it should get data from Transaction table say Emp_Trans and display it in the datagrid.based on the selected criteria.</p> <p>Your help will be appreciated..</p> <p> </p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4862 Silver123 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 16 Nov 2010 07:37:02 GMT RE: WCF RIA Services Part 2: Querying Data Silver123: As long as those multiple criteria are based on properties of the entity or its related entities that are brought down during the query as [Include] properties on the root entity, it should just be a matter of expressing them all as part of the LINQ expression on the EntityQuery<T> object when you call Load. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4859 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Mon, 15 Nov 2010 14:58:58 GMT RE: WCF RIA Services Part 2: Querying Data <p>thanks!!</p> <p>But my query is how to query data using multiple criteria like empid,cadreid in combo boxes and selecting the criteria from combo box and clicking on search it should display record in grid.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4858 silver123 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Mon, 15 Nov 2010 14:32:46 GMT RE: WCF RIA Services Part 2: Querying Data Ok thanks Brian. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4676 Glen http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 13 Oct 2010 15:35:32 GMT RE: WCF RIA Services Part 2: Querying Data Glen, be aware the code that works with VS 2008 was pre-release beta code that was not updated with all the changes that went into the 4.0 release and will not be updated or supported. I would not build any real apps against that and using it will teach you certain coding patterns that do not apply to the final release. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4675 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 13 Oct 2010 15:13:03 GMT RE: WCF RIA Services Part 2: Querying Data I meant VS 2008 SP1 http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4673 Glen http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 13 Oct 2010 15:09:18 GMT RE: WCF RIA Services Part 2: Querying Data <p>I have now completed this article with .Net 3.5 in VA 2008 SP1</p> <p> System.ServiceModel.DomainServices.Client from Silverlight 4 is contained in System.Windows.Ria in Silverlight 3</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4672 Glen http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 13 Oct 2010 15:08:33 GMT RE: WCF RIA Services Part 2: Querying Data Glen, RIA Services is only supported in .NET 4 / SL 4 in VS 2010. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4664 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 13 Oct 2010 13:44:42 GMT RE: WCF RIA Services Part 2: Querying Data I am using .Net 3.5 as only have Visual Studio 2008 SP1 available. I don't seem to be able to reference System.ServiceModel.DomainServices.Client as it doesn't exist. Is there some alternative? http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4663 Glen http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 13 Oct 2010 13:42:14 GMT RE: WCF RIA Services Part 2: Querying Data Already submitted, should hit the wire any day now http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4139 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 03 Aug 2010 07:58:21 GMT RE: WCF RIA Services Part 2: Querying Data Very keen to view your next Post on MVVM and WCF RIA Services. When it is going to be posted? http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4133 Robin http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Mon, 02 Aug 2010 14:36:09 GMT RE: WCF RIA Services Part 2: Querying Data Thank you!  Once I finally got my navigation, design and connectivity going.  This is like candy because of the diversity of ways to query and display the data. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4070 technette http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 27 Jul 2010 19:28:13 GMT RE: WCF RIA Services Part 2: Querying Data <p>Great series, Thank you for your time and effort.</p> <p>My client side generated classes (...web.g.cs) have namespaces generated like: proj.Web.Models, Proj.Web.Views while your code has generated TaskManager and TaskManager.Web --  different code is being generated. What version of Silverlight  SDK are you using (mine is April 2010)? There appears to be some other differences as well.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4054 Gary G http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Sat, 24 Jul 2010 02:50:01 GMT RE: WCF RIA Services Part 2: Querying Data Gary, I am using the released version of the Silverlight 4 Tools for Visual Studio, which is how RIA Services shipped in May. However, I just noticed that download was updated on 7/7 so am updating my tools to that latest release. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4053 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 23 Jul 2010 22:11:31 GMT RE: WCF RIA Services Part 2: Querying Data <p>Great series, Thank you for your time and effort.</p> <p>My client side generated classes (...web.g.cs) have namespaces generated like: proj.Web.Models, Proj.Web.Views while your code has generated TaskManager and TaskManager.Web --  different code is being generated. What version of Silverlight  SDK are you using (mine is April 2010)? There appears to be some other differences as well.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment4052 Gary G http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 23 Jul 2010 20:46:31 GMT RE: WCF RIA Services Part 2: Querying Data <p>Nice article.</p> <p>Would be wonderful to make a real example for e.g. Oracle->Pocos->DataService->Context->MVVM->View with service containing functions and queries.</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment3986 Rüdiger http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Wed, 14 Jul 2010 10:50:35 GMT RE: WCF RIA Services Part 2: Querying Data Wonderfull article, But you can drag and drop directly from the datasource into mainpage without writing any piece of code, and works perfectly. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment3957 Compuanalisis http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Fri, 09 Jul 2010 04:13:11 GMT RE: WCF RIA Services Part 2: Querying Data Your tutorial is great! Dario from Rome, Italy http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment3929 Dario http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 06 Jul 2010 15:30:41 GMT RE: WCF RIA Services Part 2: Querying Data Chuck: see the following post: http://briannoyes.net/2010/06/29/QueryingWCFRIAServicesAndHandlingAsyncResults.aspx http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment3890 Brian Noyes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Tue, 29 Jun 2010 23:12:21 GMT RE: WCF RIA Services Part 2: Querying Data <p>Thanks for the work on these tutorials, really helps me get started with EF and Silverlight.</p> <p>But I do have one question (you'll probably get to it later), I need to retrieve some data from EF and work with it before displaying it on the screen.  Could you show me a simple example of walking down thru the data and processing each row??</p> <p> </p> <p>Thanks Chuck</p> http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment3873 Chuck Snyder http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 24 Jun 2010 22:06:39 GMT RE: WCF RIA Services Part 2: Querying Data Thanks so much for doing these series, they're very helpful when we want to learn silverlight. http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx#comment3872 Rachida Dukes http://www.silverlightshow.net/items/WCF-RIA-Services-Part-2-Querying-Data.aspx Thu, 24 Jun 2010 14:58:29 GMT