<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">ADO.NET Data Services Team Blog</title><subtitle type="html" /><id>http://blogs.msdn.com/astoriateam/atom.xml</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/astoriateam/atom.xml" /><generator uri="http://communityserver.org" version="2.1.61025.2">Community Server</generator><updated>2009-09-01T15:08:09Z</updated><entry><title>Data Services Release Plan Update</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/11/25/data-services-release-plan-update.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/11/25/data-services-release-plan-update.aspx</id><published>2009-11-25T08:00:01Z</published><updated>2009-11-25T08:00:01Z</updated><content type="html">&lt;p&gt;We’ve heard a lot of feedback since we first discussed our plans to create v1.5 of Data Services (&lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/03/01/announcing-ado-net-data-services-v1-5-ctp1.aspx"&gt;http://blogs.msdn.com/astoriateam/archive/2009/03/01/announcing-ado-net-data-services-v1-5-ctp1.aspx&lt;/a&gt;).&amp;#160; Since that time we’ve been busy improving the quality of the product, adding features and solidifying our release plans.&amp;#160;&amp;#160; The remainder of this post discusses our target release plan for the next version of Data Services and when the final bits will be available.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;One area we heard consistent feedback on was the desire to limit the number of Data Service releases where possible.&amp;#160; To address this need we have decided to change the ship vehicle for the release to be an in-place update of the data services binaries that shipped with the .NET Framework 3.5 SP1 (instead of a SxS release as was the case for the v1.5 CTP1 release).&amp;#160; The release will ship as a redistributable update to the .NET Framework 3.5 SP1, which will include enhanced data services runtime assemblies and an updated datasvcutil.exe command line tool.&amp;#160; As you’d expect, since the release is shipping as an update to the .NET Framework 3.5 SP1, all the binaries shipped with the release will be named as they were in the .NET Framework 3.5 SP1 release (i.e. System.Data.Services.*.dll).&amp;#160; In addition to shipping an update to the .NET Framework 3.5 SP1, we’ll release a new Silverlight 3-compatible client library and the .NET-related client and server features from the .NET 3.5 SP1 update release &lt;b&gt;will be directly included in the subsequent .NET Framework 4.0 release&lt;/b&gt;.&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;We will also be changing the release name to better convey that it is an in-place update to the .NET Framework 3.5 SP1. We’ll be dropping “v1.5” from the name and simply calling it&amp;#160; the &lt;em&gt;Data Services Update for the .NET Framework 3.5 SP1&lt;/em&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;We aren’t yet ready to talk about a specific release date (we’re getting close :) ), but we are focused on this calendar year as our target window to release the update to the .NET Framework 3.5 SP1.&amp;#160; After that, as mentioned above, the feature set will be directly included in the subsequent .NET Framework 4 release.&lt;/p&gt;  &lt;p&gt;The feature set for the release will include the features we have already discussed on the data services blog (&lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/03/01/announcing-ado-net-data-services-v1-5-ctp1.aspx"&gt;http://blogs.msdn.com/astoriateam/archive/2009/03/01/announcing-ado-net-data-services-v1-5-ctp1.aspx&lt;/a&gt; &amp;amp; &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx"&gt;http://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx&lt;/a&gt; ) &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;-Mike Flasko&lt;/p&gt;  &lt;p&gt;Data Services, Lead Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9928430" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry><entry><title>Introducing the Microsoft Open Data Protocol Visualizer</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/11/17/introducing-the-microsoft-open-data-protocol-visualizer.aspx" /><link rel="enclosure" type="application/octet-stream" length="64364" href="http://blogs.msdn.com/astoriateam/attachment/9923781.ashx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/11/17/introducing-the-microsoft-open-data-protocol-visualizer.aspx</id><published>2009-11-17T19:36:00Z</published><updated>2009-11-17T19:36:00Z</updated><content type="html">&lt;H3&gt;1. Introduction&lt;/H3&gt;
&lt;P&gt;The Open Data Protocol Visualizer for Visual Studio (“the visualizer”) is a extension that provides a read-only visualization of the types, properties, associations, and other objects in the &lt;A href="http://msdn.microsoft.com/en-us/library/bb387122.aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb387122.aspx"&gt;Entity Data Model (EDM)&lt;/A&gt; returned from an &lt;A href="http://msdn.microsoft.com/en-us/library/cc716656.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc716656.aspx"&gt;Open Data Protocol’s metadata endpoint&lt;/A&gt; (this document assumes basic familiarity with the EDM).&lt;/P&gt;
&lt;P&gt;For instructions on how to create a data service, &lt;A href="http://msdn.microsoft.com/en-us/library/cc907912.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc907912.aspx"&gt;see here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;This blog post uses a slightly modified version of a model reverse-engineered from part of the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;amp;displaylang=en"&gt;Northwind database&lt;/A&gt;. For general purposes, the &lt;A href="http://www.codeplex.com/MSFTDBProdSamples" mce_href="http://www.codeplex.com/MSFTDBProdSamples"&gt;AdventureWorks sample database&lt;/A&gt;, or any other database you choose, will work as well.&lt;/P&gt;
&lt;H3&gt;2. Walkthrough&lt;/H3&gt;
&lt;P&gt;The modifications made to the Northwind model were done in order to demonstrate additional features of the visualizer. Specifically:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; The address fields in various types in the model have been replaced by the usage of a &lt;A href="http://msdn.microsoft.com/en-us/library/bb738466.aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb738466.aspx"&gt;Complex Type&lt;/A&gt; called “Address”. &lt;BR&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; A subtype of Product called “DiscontinuedProduct” has been added. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;a.&lt;/STRONG&gt; The “Discontinued” property has been removed from Product. &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;b.&lt;/STRONG&gt; Product is mapped to the Products table with condition Discontinued=false &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;c.&lt;/STRONG&gt; DiscontinuedProduct is mapped to the Products table with condition Discontinued=true &lt;BR&gt;&lt;STRONG&gt;3.&lt;/STRONG&gt; Two &lt;A href="http://msdn.microsoft.com/en-us/library/cc716710.aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc716710.aspx"&gt;function imports&lt;/A&gt; have been added to the model for the “Employee_Sales_by_Country” and “Sales_by_Year” stored procedures. &lt;BR&gt;&lt;STRONG&gt;4.&lt;/STRONG&gt; For each stored procedure, a complex type has been created to hold its results, and a method added to the data context to enable it.&lt;/P&gt;
&lt;P&gt;The XML for this model is available for download &lt;A href="http://blogs.msdn.com/astoriateam/attachment/9923781.ashx" mce_href="http://blogs.msdn.com/astoriateam/attachment/9923781.ashx"&gt;&lt;STRONG&gt;here&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;H4&gt;2.1 Install&lt;/H4&gt;
&lt;P&gt;Launch the “Extension Manager” from the Visual Studio “Tools” menu. The visualizer is available from the online gallery, and you can find it quickly by entering “Open Data Protocol” into the search field:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb.png" width=632 height=72 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb.png"&gt;&lt;/A&gt; &lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;The visualizer is available for download from the Visual Studio Gallery here:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://visualstudiogallery.msdn.microsoft.com/en-us/f4ac856a-796e-4d78-9a3d-0120d8137722" mce_href="http://visualstudiogallery.msdn.microsoft.com/en-us/f4ac856a-796e-4d78-9a3d-0120d8137722"&gt;http://visualstudiogallery.msdn.microsoft.com/en-us/f4ac856a-796e-4d78-9a3d-0120d8137722&lt;/A&gt;&lt;/P&gt;
&lt;H4&gt;2.2 Setup&lt;/H4&gt;
&lt;P&gt;To get up and running:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; Create a solution containing a web application project and a console application.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; Add a new, blank ADO.NET Entity Data Model to the web application.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3.&lt;/STRONG&gt; Close the model.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4.&lt;/STRONG&gt; Right-click the model file, select “Open With” and in the list, select “XML Editor”.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;5.&lt;/STRONG&gt; Paste the contents of the &lt;A href="http://blogs.msdn.com/astoriateam/attachment/9923781.ashx" mce_href="http://blogs.msdn.com/astoriateam/attachment/9923781.ashx"&gt;Modified Northwind Model&lt;/A&gt; into it.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;6.&lt;/STRONG&gt; Save and close the model file.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;7.&lt;/STRONG&gt; If you do not have it already set up, add the Northwind.MDF database to the web application’s App_Data folder. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;8.&lt;/STRONG&gt; Double-click the model file to open it with the designer.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;9.&lt;/STRONG&gt; Right click on the designer surface and select “Update Model from Database”.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;10.&lt;/STRONG&gt; Select the connection to Northwind.MDF, which will be automatically created for you when the MDF file is added to App_Data. If you are using your own database, you may need to create a new connection to it.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;11.&lt;/STRONG&gt; Proceed through the update wizard, accepting all the defaults, adding no new objects. This process will set up the database connection for you in web.config. It should look like this:&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: #a31515; FONT-SIZE: 9.5pt"&gt;add&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: red; FONT-SIZE: 9.5pt"&gt;name&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;=&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;"&lt;SPAN style="COLOR: blue"&gt;NORTHWNDEntities&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;connectionString&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&amp;amp;quot;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;&amp;amp;quot;&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;providerName&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;System.Data.EntityClient&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt; /&amp;gt; &lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;STRONG&gt;12.&lt;/STRONG&gt; Add a new WCF Data Service (in Beta2 this will show up as ADO.NET Data Service) and configure it as shown below. Note the additional web methods and the exposure of all entity sets and all service operations using the “*” string. This lack of security means that this is not a data service that you would want to expose publicly.&lt;/P&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System.Collections.Generic; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System.Data.Objects; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System.Data.Services; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System.Data.Services.Common; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System.Linq; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System.ServiceModel.Web; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;using&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; System.Web;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: consolas; COLOR: blue; FONT-SIZE: 9.5pt"&gt;namespace&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt; NorthwindServices &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;{ &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;NorthwindService&lt;/SPAN&gt; : &lt;SPAN style="COLOR: #2b91af"&gt;DataService&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;NORTHWNDEntities&lt;/SPAN&gt;&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{ &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;// This method is called only once to initialize service-wide policies. &lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; InitializeService(&lt;SPAN style="COLOR: #2b91af"&gt;DataServiceConfiguration&lt;/SPAN&gt; config) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{ &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;config.SetEntitySetAccessRule(&lt;SPAN style="COLOR: #a31515"&gt;"*"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;EntitySetRights&lt;/SPAN&gt;.AllRead); &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;config.SetServiceOperationAccessRule(&lt;SPAN style="COLOR: #a31515"&gt;"*"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;ServiceOperationRights&lt;/SPAN&gt;.All); &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;config.DataServiceBehavior.MaxProtocolVersion = &lt;SPAN style="COLOR: #2b91af"&gt;DataServiceProtocolVersion&lt;/SPAN&gt;.V2; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;} &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;WebGet&lt;/SPAN&gt;] &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ObjectResult&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Employee_Sales_by_Country_Result&lt;/SPAN&gt;&amp;gt; GetEmployeeSalesByCountry(&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; start, &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; end) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{ &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NORTHWNDEntities&lt;/SPAN&gt; entities = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;NORTHWNDEntities&lt;/SPAN&gt;(); &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; entities.Employee_Sales_by_Country(start, end); &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;} &lt;/P&gt;&lt;/SPAN&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-layout-grid-align: none" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;WebGet&lt;/SPAN&gt;] &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;public&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ObjectResult&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Sales_by_Year_Result&lt;/SPAN&gt;&amp;gt; GetSalesByYear(&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; start, &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt; end) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{ &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;NORTHWNDEntities&lt;/SPAN&gt; entities = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;NORTHWNDEntities&lt;/SPAN&gt;(); &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; entities.Sales_by_Year(start, end); &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;} &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;} &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: consolas; FONT-SIZE: 9.5pt"&gt;} &lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;STRONG&gt;13.&lt;/STRONG&gt; Right click on the service and select “View in Browser”.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;14.&lt;/STRONG&gt; Copy the URL shown in the browser, it should look like this: &lt;I&gt;http://localhost:11968/NorthwindService.svc&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;15.&lt;/STRONG&gt; In the console application project add a new service reference.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;16.&lt;/STRONG&gt; Paste the URL into the “Address” field. Change the “Namespace” to “NorthwindServiceReference”, as shown below.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_4.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_1.png" width=543 height=444 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;17.&lt;/STRONG&gt; Click OK.&lt;/P&gt;
&lt;H4&gt;2.3 Visualizing the Model&lt;/H4&gt;
&lt;P&gt;The visualizer consists of two main components: The &lt;B&gt;diagram&lt;/B&gt;, which can show all, or part of the model, as a two-dimensional graph, and the &lt;B&gt;model browser&lt;/B&gt;, which is a Visual Studio tool window that presents the complete contents of the model as a hierarchical tree. We begin by examining the structure and capabilities of the diagram.&lt;/P&gt;
&lt;H4&gt;2.4 Launching the Visualizer&lt;/H4&gt;
&lt;P&gt;Once installed, the visualizer is launched by right-clicking any Service Reference that supports the Open Data Protocol&lt;A title=_GoBack name=_GoBack&gt;&lt;/A&gt; and selecting “View in Diagram”:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_6.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_6.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_2.png" width=365 height=410 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_2.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;This will bring up the overview screen in a new document window. This screen provides a number of quick links for rapidly creating a diagram:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_8.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_8.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_3.png" width=631 height=253 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid #4f81bd 1.0pt; mso-border-themecolor: accent1; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoTableMediumList2Accent1 border=1 cellSpacing=0 cellPadding=0 class="MsoTableMediumList2Accent1"&gt;
&lt;TBODY&gt;
&lt;TR style="mso-yfti-irow: -1; mso-yfti-firstrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 3pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 149.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-border-bottom-themecolor: accent1; mso-background-themecolor: background1" vAlign=top width=199&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 517" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;&lt;STRONG&gt;Link&lt;/STRONG&gt; 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 3pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 329.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-border-bottom-themecolor: accent1; mso-background-themecolor: background1" vAlign=top width=439&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 1" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; FONT-SIZE: 12pt; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;&lt;STRONG&gt;Behavior &lt;/STRONG&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 0"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 149.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-border-right-themecolor: accent1" vAlign=top width=199&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 68" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Data services model browser 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 329.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #d3dfee; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: accent1; mso-border-right-themecolor: accent1; mso-background-themetint: 63" vAlign=top width=439&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 64" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Will make the model browser tool window visible. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 1"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 149.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-border-right-themecolor: accent1" vAlign=top width=199&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 4" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Add all namespaces 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 329.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-border-right-themecolor: accent1" vAlign=top width=439&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Adds all entity types and complex types, and by extension, all associations, to the model. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 2"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 149.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-border-right-themecolor: accent1" vAlign=top width=199&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 68" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Add all entity types 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 329.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #d3dfee; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: accent1; mso-border-right-themecolor: accent1; mso-background-themetint: 63" vAlign=top width=439&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 64" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Will add all entity types, and any associations between them, to the diagram. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 3"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 149.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-border-right-themecolor: accent1" vAlign=top width=199&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 4" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Add all hubs 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 329.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-border-right-themecolor: accent1" vAlign=top width=439&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Will add the entity types whose number of associations is in the top 25% in the model to the diagram. This is intended to provide a useful starting point in making sense of models by adding only the most highly connected types. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 4"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 149.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-border-right-themecolor: accent1" vAlign=top width=199&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 68" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Add all complex types 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 329.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #d3dfee; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: accent1; mso-border-right-themecolor: accent1; mso-background-themetint: 63" vAlign=top width=439&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 64" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Will add all complex types to the diagram. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR style="mso-yfti-irow: 5; mso-yfti-lastrow: yes"&gt;
&lt;TD style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 149.4pt; PADDING-RIGHT: 5.4pt; BACKGROUND: white; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-background-themecolor: background1; mso-border-right-themecolor: accent1" vAlign=top width=199&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt; mso-yfti-cnfc: 4" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Add all associations 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD style="BORDER-BOTTOM: #4f81bd 1pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 329.4pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; BORDER-RIGHT: #4f81bd 1pt solid; PADDING-TOP: 0in; mso-border-bottom-themecolor: accent1; mso-border-right-themecolor: accent1" vAlign=top width=439&gt;
&lt;P style="LINE-HEIGHT: normal; MARGIN-BOTTOM: 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Cambria','serif'; COLOR: black; mso-ascii-theme-font: major-latin; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: major-fareast; mso-hansi-theme-font: major-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: major-bidi; mso-themecolor: text1"&gt;Adds all associations and their entity types to the diagram. 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;H4&gt;2.5 Working with a Diagram&lt;/H4&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; Selecting “add all hubs” will result in the following diagram:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_10.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_10.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_4.png" width=166 height=244 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_4.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; Deselect any selected objects (by clicking anywhere on the canvas) and right-click the “Employee” shape to bring up this context menu:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_12.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_12.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_5.png" width=303 height=295 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_5.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Select “Add Related Entities”.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3.&lt;/STRONG&gt; Click on Employees again and select “Add Related Complex Types”.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4.&lt;/STRONG&gt; Switch to the left-to-right view (Alt+Right Arrow.) &lt;BR&gt;The diagram now shows all entity types related to Employee as well any complex types used by it:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_14.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_14.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_6.png" width=206 height=244 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_6.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;5.&lt;/STRONG&gt; Multi-select Order and Product and select “Add Related Entities”. At this point, most of the model will be visible in the diagram. Note that all newly added objects are now selected. This is intended to accomplish two goals: Allow easy iterative addition of related types to a model, and also make it easy to distinguish newly added types from previously added types.&lt;/P&gt;
&lt;H5&gt;2.5.1 Visualizing Relationships&lt;/H5&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; We can further simplify the rendering of the model by changing the way shapes are rendered. Right click anywhere in the diagram and unmark the “Expanded Shapes” checkbox command. This will hide all properties, making it easier to focus on relationships between types:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_16.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_16.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_7.png" width=244 height=225 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_7.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; Selecting an association will highlight the navigation properties that navigate it. For example, after expanding the shapes to show properties again, we select the association between Employee and Territory and see that navigation properties Employee.Territories and Territory. Employees, which traverse this association, become highlighted:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_18.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_18.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_8.png" width=244 height=182 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_8.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;H3&gt;3 Using the Model Browser&lt;/H3&gt;
&lt;P&gt;The Model Browser provides an unfiltered view of the model. Its root contains a schema node for each namespace in a model, and a node the EntityContainer.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_20.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_20.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_9.png" width=292 height=278 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_9.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;To show the model browser, go to the “View” menu item in Visual Studio and select “Data Services Model Browser”. You can also right-click in the visualizer and select “Show In Model Browser”, which will bring the model browser into view and select the object under the mouse.&lt;/P&gt;
&lt;H4&gt;3.1 Schema Nodes&lt;/H4&gt;
&lt;P&gt;Schema nodes show the entity types, complex types, and associations in a schema.&lt;/P&gt;
&lt;P&gt;To add a type to the diagram, expand the Entity Types node and drag and drop it onto the diagram. You can also right-click the type and click on “Select in Diagram,” or double-click it. This will add the type to the diagram if it is not present, select it, and scroll the diagram to make the type shape visible.&lt;/P&gt;
&lt;P&gt;These same actions also work for complex types and associations. In the latter case, adding an association to the diagram will add both of the association’s ends’ entity types as well.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; Clear the diagram by selecting all objects using Ctrl+A and removing them using the Delete key. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; Double-click the “Employee” entity type.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;3.&lt;/STRONG&gt; Drag and drop “Order” onto the diagram. Note that the location of the drop does not matter, as the layout in the diagram is always automatic.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;4.&lt;/STRONG&gt; Right-click the “Address” complex type and click on “Select In Diagram”. Finally, double-click on the “FK_Orders_Shippers” association. With a left to right layout, your diagram should look like this:&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_22.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_22.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_10.png" width=244 height=206 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_10.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Note that the addition of the foreign key added the “Shipper” type and selected both it and “Order”, which make up both sides of the association, and also selected the two navigation properties, “Order.Shipper” and “Shipper.Orders”, which traverse this association.&lt;/P&gt;
&lt;H5&gt;3.1.1 Properties&lt;/H5&gt;
&lt;P&gt;While the diagram surface does not yet allow selection of properties, the model browser does. Expand the Entity Types node, and within it, expand the “Category” type. Right-click “CategoryID” and select “View Generated Code” to see the code generated for this property. Close the code, right-click “CategoryID” and select “Properties” to view the property sheet for it.&lt;/P&gt;
&lt;H4&gt;3.2 EntityContainer Nodes&lt;/H4&gt;
&lt;P&gt;Expand the Entity Sets node and right-click on “Categories”. Selecting “View Generated Code” will take you to the dataServiceQuery&amp;lt;Category&amp;gt; that was generated from this entity set. Next, select “Go to Entity Type”, which should select the “Category” type. Finally, select “View in Browser” which will bring up the browser and point it at http://[your server]/NorthwindDataService.svc/Categories. Note that selecting “View In Browser” on entity types, for example on “Category”, will bring up the same URL, as all such queries must reference a type’s entity set.&lt;/P&gt;
&lt;H4&gt;3.3 The Search Bar&lt;/H4&gt;
&lt;P&gt;At the top of the model browser is the search bar. Collapse down the model browser to its root node and click the search box labeled “Type here to search”. In the search box, type “cat” and hit enter or click on the icon. The search will cover all objects in the entity container and schema nodes, down to individual properties or association ends. The model browser will show the search results bar, expand all nodes with matches and highlight those matches, and provide tick marks on the scroll bar:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_24.png" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_24.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_11.png" width=292 height=521 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroducingtheMicrosoftOpenDataProtocolV_A319/image_thumb_11.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Click the up/down arrows to the right of the “Items matching…” message to move forward and back through results. You can also click on tick marks, which will scroll the corresponding match into view and select it. When you are done, click the button at the right of the search results bar to clear out the search. You can perform this search again any time by selecting the search from the search box’s drop-down search history:&lt;/P&gt;
&lt;H3&gt;4. Conclusion&lt;/H3&gt;
&lt;P&gt;This walkthrough does not touch on some additional capabilities of the visualization tool, such as the ability to display data services-specific metadata. We will cover these capabilities, and others, when we release the next update to this tool.&lt;/P&gt;
&lt;P&gt;We hope you will find this tool useful and look forward to your feedback.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Noam Ben-Ami &amp;amp; Fabian Winternitz&lt;BR&gt;&lt;/STRONG&gt;Microsoft&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923781" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author><category term="ADO.NET Data Services" scheme="http://blogs.msdn.com/astoriateam/archive/tags/ADO.NET+Data+Services/default.aspx" /><category term="Data Services Futures" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Data+Services+Futures/default.aspx" /><category term="OData" scheme="http://blogs.msdn.com/astoriateam/archive/tags/OData/default.aspx" /></entry><entry><title>Breaking Down ‘Data Silos’ – The Open Data Protocol (OData)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/11/17/breaking-down-data-silos-the-open-data-protocol-odata.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/11/17/breaking-down-data-silos-the-open-data-protocol-odata.aspx</id><published>2009-11-17T09:39:00Z</published><updated>2009-11-17T09:39:00Z</updated><content type="html">&lt;P&gt;A few weeks ago we &lt;A href="http://blogs.msdn.com/astoriateam/archive/2009/10/19/share-your-data-across-data-sources-sharepoint-sql-server-azure-reporting-services-etc-applications-net-silverlight-excel-etc-using-data-services.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/10/19/share-your-data-across-data-sources-sharepoint-sql-server-azure-reporting-services-etc-applications-net-silverlight-excel-etc-using-data-services.aspx"&gt;posted&lt;/A&gt; about steps we’ve been taking to enable a wide range of data sources (DB, SharePoint, Reports, Cloud storage services, etc) to expose their data for programmatic access from any platform (Java, PHP, Silverlight, .NET, AJAX, etc) using a simple HTTP/AtomPub based protocol as the means of communication.&amp;nbsp; Our exploration in the area of data sharing has been driven by frustration we’ve observed in the broader community around the fact that data tends to exist in horizontal or vertical silos: it can be shared within a particular environment but often becomes difficult to use beyond its original intent. For example, one factor that can contribute to such a “silo effect”, is application domain/business logic that changes the shape of its data such that it is harder to share. As systems continue to become more interconnected, the need to reuse information in its raw form or exposed through layers of domain/business logic grows and, it probably goes without saying, such data becomes more valuable the more it can be shared. It is this need for data sharing, regardless of the type of data source, where the “silo effect” becomes increasingly painful.&lt;/P&gt;
&lt;P&gt;Driven by the goal to enable simple data sharing across disparate data sources, today, at &lt;A href="http://microsoftpdc.com/" mce_href="http://microsoftpdc.com/"&gt;PDC&lt;/A&gt;, we are announcing the &lt;A href="http://www.odata.org/" mce_href="http://www.odata.org/"&gt;Open Data Protocol (OData)&lt;/A&gt;.&amp;nbsp; OData is an open protocol for sharing data that provides a way to break down data silos and increase the shared value of data by creating an ecosystem in which data consumers can interoperate with data producers in a way that is far more powerful than currently possible, enabling more applications to make sense of a broader set of data. Every producer and consumer of data that participates in this ecosystem increases its overall value. This is similar in many ways to Microsoft’s efforts with ODBC, although applied to the Web environment and supporting a variety of data sources including (but not limited to) relational databases, file systems, content management systems, and traditional web sites.&lt;/P&gt;
&lt;P&gt;OData applies web technologies such as &lt;A href="http://www.w3.org/Protocols/" mce_href="http://www.w3.org/Protocols/"&gt;HTTP&lt;/A&gt;, &lt;A href="http://www.ietf.org/rfc/rfc4287.txt" mce_href="http://www.ietf.org/rfc/rfc4287.txt"&gt;Atom Publishing Protocol &lt;/A&gt;(AtomPub) and &lt;A href="http://json.org/" mce_href="http://json.org/"&gt;JSON&lt;/A&gt; to provide access to information from a variety of applications, services, and stores and will be published under the &lt;A href="http://www.microsoft.com/interop/osp/default.mspx" mce_href="http://www.microsoft.com/interop/osp/default.mspx"&gt;Open Specification Promise&lt;/A&gt; to allow anyone to freely interoperate with OData implementations.&amp;nbsp; OData was previously known informally as the “&lt;A href="http://msdn.microsoft.com/en-us/library/dd541188(PROT.10).aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd541188(PROT.10).aspx"&gt;data services protocol&lt;/A&gt;”, however, we’re renaming the specification to better express its intent.&amp;nbsp; We are very interested in working with the web community around how to best align OData to future versions of AtomPub or other appropriate standards and welcome participation from anyone interesting in furthering the type of data sharing ecosystem OData strives to enable.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;From a Microsoft standpoint, the &lt;A href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" mce_href="http://msdn.microsoft.com/en-us/data/bb931106.aspx"&gt;Data Services framework&lt;/A&gt; was the first Microsoft technology to support the Open Data Protocol in Visual Studio 2008 SP1 and provides developers with client libraries for .NET, Silverlight, AJAX, PHP and Java. In addition to developing WCF Data Services, Microsoft currently supports the OData in &lt;A href="http://www.microsoft.com/sqlserver/2008/" mce_href="http://www.microsoft.com/sqlserver/2008/"&gt;SQL Server&lt;/A&gt; 2008 R2, &lt;A href="http://msdn.microsoft.com/en-us/library/dd179423.aspx" mce_href="http://msdn.microsoft.com/en-us/library/dd179423.aspx"&gt;Windows Azure Table Storage&lt;/A&gt;, Excel 2010 (through &lt;A href="http://www.powerpivot.com/" mce_href="http://www.powerpivot.com/"&gt;PowerPivot&lt;/A&gt;) and &lt;A href="http://sharepoint2010.microsoft.com/product/Benefits/IT-Developers/Pages/Top-Features.aspx" mce_href="http://sharepoint2010.microsoft.com/product/Benefits/IT-Developers/Pages/Top-Features.aspx"&gt;SharePoint 2010&lt;/A&gt; with many other applications (such as &lt;A href="http://www.microsoft.com/mediaroom/" mce_href="http://www.microsoft.com/mediaroom/"&gt;Microsoft Mediaroom&lt;/A&gt;) in the works.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;In addition to MSFT technologies, we’ve also already seen interest in the community to grow the OData ecosystem.&amp;nbsp; For example, &lt;A href="http://www.ibm.com/developerworks/websphere/downloads/xs_rest_service.html" mce_href="http://www.ibm.com/developerworks/websphere/downloads/xs_rest_service.html"&gt;IBM’s WebSphere eXtreme Scale project implements the protocol&lt;/A&gt; to enable broad accessibility to their grid technologies. &lt;/P&gt;
&lt;P&gt;We’re actively working to provide more public facing data and tools for OData.&amp;nbsp; For now, be sure to check out &lt;A href="http://www.odata.org/" mce_href="http://www.odata.org"&gt;www.odata.org&lt;/A&gt;. As we progress we’ll be sure to post our thoughts and ideas for your feedback.&amp;nbsp; We look forward to your feedback and participation in this effort.&lt;/P&gt;
&lt;P&gt;-Mike Flasko&lt;/P&gt;
&lt;P&gt;Lead Program Manager, Microsoft&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923457" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author><category term="PDC" scheme="http://blogs.msdn.com/astoriateam/archive/tags/PDC/default.aspx" /><category term="ADO.NET Data Services" scheme="http://blogs.msdn.com/astoriateam/archive/tags/ADO.NET+Data+Services/default.aspx" /><category term="What's New" scheme="http://blogs.msdn.com/astoriateam/archive/tags/What_2700_s+New/default.aspx" /><category term="OData" scheme="http://blogs.msdn.com/astoriateam/archive/tags/OData/default.aspx" /></entry><entry><title>Simplifying our n-tier development platform: making 3 things 1 thing</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/11/17/simplifying-our-n-tier-development-platform-making-3-things-1-thing.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/11/17/simplifying-our-n-tier-development-platform-making-3-things-1-thing.aspx</id><published>2009-11-17T09:39:00Z</published><updated>2009-11-17T09:39:00Z</updated><content type="html">&lt;P&gt;As you’ve probably observed, we’ve been working hard over the past year or so to grow our application stacks to better support the types of applications (Silverlight, rich desktop, AJAX, etc) and services (SOAP, REST, etc) that are required to build modern, robust solutions.&amp;nbsp; At present, a few of the technologies we have to help in building services &amp;amp; n-tier applications are: &lt;A href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx" mce_href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx"&gt;Windows Communication Foundation&lt;/A&gt;, &lt;A href="http://www.silverlight.net/riaservices/" mce_href="http://www.silverlight.net/riaservices/"&gt;.NET RIA Services&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" mce_href="http://msdn.microsoft.com/en-us/data/bb931106.aspx"&gt;ADO.NET Data Services&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;We’ve been very pleased to see each of these stacks be well received in the community and, given that positive feedback, we’ve been eagerly working on expanding each based on your comments.&amp;nbsp; While today these stacks target different application scenarios and/or levels of abstraction, we see opportunities to align their foundations by building the concepts shared in each stack (authentication, conventions for business logic, logging, configuration, etc) on a single foundation.&amp;nbsp; Additionally, we’ve heard your feedback that traversing our offerings in this space is, at times, too complicated.&lt;/P&gt;
&lt;P&gt;So, with the goal of simplifying our platform by aligning common components, we’d like to announce a few changes we’ll be making to achieve our goals….&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Windows Communication Foundation (WCF) == your “one stop shop” for building services and n-tier applications&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Since .NET Fx 3.0, WCF has been the place to go to in the .NET Framework to rapidly build service-oriented applications that communicate across the web and the enterprise.&amp;nbsp; As we’ve developed the product roadmaps for .NET RIA Services and ADO.NET Data Services we’ve found they complement the core WCF stack quite well as components/extensions for WCF or as new top-level layers of abstraction.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;To formalize our direction in aligning these technologies, we’re making a few name changes in the .NET Framework 4 timeframe.&amp;nbsp; ADO.NET Data Services will change its name slightly to be &lt;B&gt;WCF Data Services &lt;/B&gt;and .NET RIA Services will be known as &lt;B&gt;WCF RIA Services&lt;/B&gt;.&amp;nbsp; We’ll be talking about our alignment of these technologies starting at this &lt;A href="http://microsoftpdc.com/" mce_href="http://microsoftpdc.com/"&gt;PDC&lt;/A&gt;, so if you are attending, keep an eye out for sessions and information at the event.&lt;/P&gt;
&lt;P&gt;We think of these name changes as a key first step in simplifying our offerings in this space.&amp;nbsp; Starting at this PDC and continuing over the coming Silverlight &amp;amp; .NET Framework releases cycles, you’ll see us further bring together these applications stacks such that you can leverage key parts of each in one WCF-based application.&amp;nbsp; As we progress along this path we’ll be sure to post our thinking to get your feedback. &lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Q&amp;amp;A&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;We thought this might generate a few questions, so here’s a couple Q&amp;amp;As on the topic that should help clarify this announcement…&lt;/P&gt;
&lt;P&gt;Q: Now that the names are aligned, when will alignment occur in the products?&lt;/P&gt;
&lt;P&gt;A:&amp;nbsp; We’ll start aligning the technologies in the .NET Framework 4 and Silverlight 4 timeframes and, guided by your feedback, continue through subsequent release cycles as appropriate.&lt;/P&gt;
&lt;P&gt;Q: Doesn’t ADO.NET Data Services and .NET RIA Services already use WCF?&lt;/P&gt;
&lt;P&gt;A: They do, but we believe we can further their alignment &amp;amp; integration to provide a more seamless developer experience.&lt;/P&gt;
&lt;P&gt;Q: Does this mean you are changing the direction of Data Services?&lt;/P&gt;
&lt;P&gt;A: The vision we have for Data Services does not change with this announcement. We believe this announcement further solidifies our investment in the area of simple, standards-based communication&amp;nbsp;on the web by (overtime) bringing support for the Data Services conventions directly into WCF.&amp;nbsp;&amp;nbsp;For further details, see this post on our future&amp;nbsp;direction regarding data services and OData support: &lt;A href="http://blogs.msdn.com/astoriateam/archive/2009/11/17/breaking-down-data-silos-the-open-data-protocol-odata.aspx"&gt;http://blogs.msdn.com/astoriateam/archive/2009/11/17/breaking-down-data-silos-the-open-data-protocol-odata.aspx&lt;/A&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Q: How does this announcement affect the planned Data Services update for .NET Fx 3.5 SP1?&lt;/P&gt;
&lt;P&gt;A: It doesn’t.&amp;nbsp; The Data Services update for .NET Fx 3.5 SP1 will ship as planned this calendar year.&lt;/P&gt;
&lt;P&gt;-Mike Flasko&lt;/P&gt;
&lt;P&gt;Lead Program Manager, &lt;STRIKE&gt;ADO.NET&lt;/STRIKE&gt; WCF Data Services&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923458" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author><category term="Project Codename &amp;quot;Astoria&amp;quot;" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Project+Codename+_2600_quot_3B00_Astoria_2600_quot_3B00_/default.aspx" /><category term="PDC" scheme="http://blogs.msdn.com/astoriateam/archive/tags/PDC/default.aspx" /><category term="ADO.NET Data Services" scheme="http://blogs.msdn.com/astoriateam/archive/tags/ADO.NET+Data+Services/default.aspx" /><category term="What's New" scheme="http://blogs.msdn.com/astoriateam/archive/tags/What_2700_s+New/default.aspx" /></entry><entry><title>Enabling X-Domain access to your Data Services</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/11/05/enabling-x-domain-access-to-your-data-services.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/11/05/enabling-x-domain-access-to-your-data-services.aspx</id><published>2009-11-06T06:43:08Z</published><updated>2009-11-06T06:43:08Z</updated><content type="html">&lt;p&gt;In the Astoria V1.5 CTP2 release, we introduced support for &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/03/using-the-ado-net-data-services-silverlight-client-in-x-domain-and-out-of-browser-scenarios-i.aspx"&gt;X-Domain and Out Of Browser access to Data Services&lt;/a&gt; in our Silverlight client library. &lt;/p&gt;  &lt;p&gt;This blog post talks about how to enable Cross-Domain access to Data Services from the Silverlight client library. &lt;/p&gt;  &lt;h3&gt;I am a Service author, How do I enable X-Domain access to Data Services I host in my applications?&lt;/h3&gt;  &lt;p&gt;You would need to deploy a ClientAccessPolicy.xml file to enable X-Domain and Out Of Browser access to Data Services hosted by your applications. &lt;/p&gt;  &lt;p&gt;The CAP.xml file should be deployed at the root of the Web Server hosting the Data Services and should not require authentication to access the file.&lt;/p&gt;  &lt;h3&gt;&lt;b&gt;What is a &lt;/b&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc197955%28VS.95,lightweight%29.aspx"&gt;ClientAccessPolicy.xml&lt;/a&gt;&lt;b&gt;&lt;/b&gt;&lt;b&gt; file? &lt;/b&gt;&lt;/h3&gt;  &lt;p&gt;A client access policy file defines the Services that client Silverlight applications can call    &lt;br /&gt;and the capabilities that these service calls can have.     &lt;br /&gt;Here is a sample client access policy.xml file : &lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;lt;access-policy&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160; &amp;lt;cross-domain-access&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;policy&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;allow-from http-request-headers=&amp;quot;*&amp;quot;&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;domain uri=&amp;quot;http://ui.norhtwind.com&amp;quot;/&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/allow-from&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;grant-to&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;resource path=&amp;quot;/Northwind.svc&amp;quot; include-subpaths=&amp;quot;true&amp;quot;/&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/grant-to&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/policy&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;#160; &amp;lt;/cross-domain-access&amp;gt;     &lt;br /&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&amp;lt;/access-policy&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Anatomy of&amp;#160; a ClientAccessPolicy.xml file:&lt;/h3&gt;  &lt;p&gt;The CAP.xml file contains a lot of sections to allow fine tuning of client access.    &lt;br /&gt;For a Data Service author, the following are relevant sections of the file:    &lt;br /&gt;     &lt;br /&gt;1. &lt;b&gt;&amp;lt;allow-from&amp;gt; &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Defines all the domains that are affected by this policy.    &lt;br /&gt;    &lt;br /&gt;Defines the sites that are allowed to access resources in a certain policy.     &lt;br /&gt;    &lt;br /&gt;By using the allow-from element for a particular policy, you implicitly deny access for all non-listed domains. &lt;/p&gt;  &lt;p&gt;If allow-from is empty, then the policy file grants access to no sites.    &lt;br /&gt;    &lt;br /&gt;The “&lt;b&gt;http-request-headers&lt;/b&gt;”&amp;#160; attribute of this node specifies the HTTP Request headers that client Service calls are allowed to pass to the Service. &lt;/p&gt;  &lt;p&gt;For a Data Services Silverlight client application, the following headers are required &lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;X-Http-Method &lt;/li&gt;      &lt;li&gt;DataServiceVersion&amp;#160; &lt;/li&gt;      &lt;li&gt;Accept &lt;/li&gt;      &lt;li&gt;Content-Type &lt;/li&gt;      &lt;li&gt;Location &lt;/li&gt;      &lt;li&gt;MimeType&amp;#160; &lt;/li&gt;      &lt;li&gt;MaxDataServiceVersion &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;2. &amp;lt;&lt;b&gt;allow-from&amp;gt;&amp;lt;domain/&amp;gt;&amp;lt;/allow-from&amp;gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The &lt;b&gt;“uri”&lt;/b&gt; attribute of the “&lt;b&gt;domain&lt;/b&gt;” node specifies the domain in which the client accessing the Service has to be hosted     &lt;br /&gt;to be able to call the Service.&lt;/p&gt;  &lt;p&gt;3. &lt;b&gt;&amp;lt;grant-to&amp;gt; &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The “&amp;lt;grant-to&amp;gt;” node specifies the Services which are allowed to be accessed by clients. &lt;/p&gt;  &lt;p&gt;4. &lt;b&gt;&amp;lt;grant-to&amp;gt;&amp;lt;resource/&amp;gt;&amp;lt;/grant-to&amp;gt; &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Each service , access to which is governed by the CAP.xml file, is represented by a &lt;b&gt;&amp;lt;resource&amp;gt; &lt;/b&gt;node in the &lt;b&gt;&amp;lt;grant-to&amp;gt;&lt;/b&gt; section of the CAP.xml file .     &lt;br /&gt;    &lt;br /&gt;The &lt;b&gt;&amp;lt;resource&amp;gt; &lt;/b&gt;node contains two important attributes. &lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;&lt;b&gt;path &lt;/b&gt;: this attribute is the relative path of the Data Service &lt;/li&gt;      &lt;li&gt;&lt;strong&gt;include-subpaths&lt;/strong&gt;&amp;#160; : this attribute specifies if paths based off of the resource path are allowed. This value should be set to true for a Data Service. &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;h3&gt;Additional references:&lt;/h3&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc645032%28VS.95%29.aspx"&gt;Clientaccesspolicy.xml file Schema&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/cc197955%28VS.95%29.aspx"&gt;Making a Service Available Across Domain Boundaries&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9918413" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author><category term="ADO.NET Data Services" scheme="http://blogs.msdn.com/astoriateam/archive/tags/ADO.NET+Data+Services/default.aspx" /><category term="Silverlight" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Silverlight/default.aspx" /><category term="How To" scheme="http://blogs.msdn.com/astoriateam/archive/tags/How+To/default.aspx" /><category term="X-Domain" scheme="http://blogs.msdn.com/astoriateam/archive/tags/X-Domain/default.aspx" /></entry><entry><title>Using Data Services over SharePoint 2010 – Part 2 - CRUD</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/10/29/using-data-services-over-sharepoint-2010-part-2-crud.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/10/29/using-data-services-over-sharepoint-2010-part-2-crud.aspx</id><published>2009-10-29T21:23:00Z</published><updated>2009-10-29T21:23:00Z</updated><content type="html">&lt;P&gt;In &lt;A href="http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx"&gt;part 1&lt;/A&gt; you learned how to get SharePoint 2010 and Astoria working together, how to add a Service Reference to your Client Application and how to do a basic insert. &lt;/P&gt;
&lt;P&gt;In this installment you will see full CRUD, so you’ll learn how to do queries, data binding, updates and deletes.&lt;/P&gt;
&lt;H3&gt;The Problem:&lt;/H3&gt;
&lt;P&gt;In &lt;A href="http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx"&gt;part 1&lt;/A&gt; we created a ‘Make a Suggestion’ feature for a department Line of Business application, by storing suggestions in SharePoint 2010.&lt;/P&gt;
&lt;P&gt;Now we need a little Silverlight application for reviewing all those suggestions and making comments on them. So we need to display interesting suggestions, to allow the user to provide a comment, or make edits and deletes.&lt;/P&gt;
&lt;H3&gt;The Solution:&lt;/H3&gt;
&lt;H4&gt;Step 1: Displaying suggestions&lt;/H4&gt;
&lt;P&gt;Assuming you’ve set-up your service reference (see &lt;A href="http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx"&gt;part 1&lt;/A&gt;) the next step is to create XAML to display the Suggestions:&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff face="Courier New"&gt;&amp;lt;UserControl x:Class="DataServicesOverSharepoint.MainPage" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns="&lt;/FONT&gt;&lt;A href="http://schemas.microsoft.com/winfx/2006/xaml/presentation" mce_href="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt;&lt;FONT color=#0000ff face="Courier New"&gt;http://schemas.microsoft.com/winfx/2006/xaml/presentation&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color=#0000ff face="Courier New"&gt;" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:x="&lt;/FONT&gt;&lt;A href="http://schemas.microsoft.com/winfx/2006/xaml" mce_href="http://schemas.microsoft.com/winfx/2006/xaml"&gt;&lt;FONT color=#0000ff face="Courier New"&gt;http://schemas.microsoft.com/winfx/2006/xaml&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color=#0000ff face="Courier New"&gt;" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:d="&lt;/FONT&gt;&lt;A href="http://schemas.microsoft.com/expression/blend/2008" mce_href="http://schemas.microsoft.com/expression/blend/2008"&gt;&lt;FONT color=#0000ff face="Courier New"&gt;http://schemas.microsoft.com/expression/blend/2008&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color=#0000ff face="Courier New"&gt;" xmlns:mc="&lt;/FONT&gt;&lt;A href="http://schemas.openxmlformats.org/markup-compatibility/2006" mce_href="http://schemas.openxmlformats.org/markup-compatibility/2006"&gt;&lt;FONT color=#0000ff face="Courier New"&gt;http://schemas.openxmlformats.org/markup-compatibility/2006&lt;/FONT&gt;&lt;/A&gt;&lt;FONT color=#0000ff face="Courier New"&gt;" &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Grid x:Name="LayoutRoot" ShowGridLines="False"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Grid.RowDefinitions&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RowDefinition Height="5"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RowDefinition Height="400"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RowDefinition Height="300"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RowDefinition Height="30" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;RowDefinition Height="5" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Grid.RowDefinitions&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Grid.ColumnDefinitions&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ColumnDefinition Width="5"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ColumnDefinition Width="500"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ColumnDefinition Width="5"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Grid.ColumnDefinitions&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ListBox ItemsSource="{Binding TrackedSuggestions, Mode=TwoWay}" Name="ListBox" Grid.Row="1" Grid.Column="1" ScrollViewer.VerticalScrollBarVisibility="Auto"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ListBox.ItemTemplate&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DataTemplate&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal" Margin="5"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Vertical" Margin="5"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Width="400" Text="{Binding Title}" FontWeight="Bold"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Width="400" Text="{Binding Description}" TextWrapping="Wrap"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Button Content="Delete" Click="DeleteSuggestion" Tag="{Binding}" Width="50" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/DataTemplate&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ListBox.ItemTemplate&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ListBox&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Vertical" Margin="5" Grid.Column="1" Grid.Row="2"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Width="100" Text="Title:" FontWeight="Bold"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBox Width="300" Text="{Binding ElementName=ListBox, Path=SelectedItem.Title, Mode=TwoWay}"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Width="100" Text="Description:" FontWeight="Bold"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBox Width="300" Text="{Binding ElementName=ListBox, Path=SelectedItem.Description, Mode=TwoWay}"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Width="100" Text="Created:" FontWeight="Bold"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBox Width="300" Text="{Binding ElementName=ListBox, Path=SelectedItem.Created, Mode=TwoWay}"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Width="100" Text="Modified:" FontWeight="Bold"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBox Width="300" Text="{Binding ElementName=ListBox, Path=SelectedItem.Modified, Mode=TwoWay}"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBlock Width="100" Text="Comments:" FontWeight="Bold"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TextBox Width="300" Height="150" Text="{Binding ElementName=ListBox, Path=SelectedItem.Comments, Mode=TwoWay}" AcceptsReturn="True" /&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="1" Margin="5"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Button Width="100" Name="btnNewSuggestion" HorizontalAlignment="Left" Content="New Suggestion"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Button Width="100" Name="btnSaveChanges" HorizontalAlignment="Right" Content="Save Changes"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/StackPanel&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Grid&amp;gt; &lt;BR&gt;&amp;lt;/UserControl&amp;gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;This XAML code, displays a ListBox (of suggestions) and an series of textboxes for editing the currently selected suggestion. &lt;BR&gt;&lt;BR&gt;When running it should looks something like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharePoint2010Part2_8CCB/SuggestionsVisualizer.jpg" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharePoint2010Part2_8CCB/SuggestionsVisualizer.jpg"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=SuggestionsVisualizer border=0 alt=SuggestionsVisualizer src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharePoint2010Part2_8CCB/SuggestionsVisualizer_thumb.jpg" width=169 height=244 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharePoint2010Part2_8CCB/SuggestionsVisualizer_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;To make this work we have a very simple class to encapsulate Data Services and the Data:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;public class SuggestionContext &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TeamSiteDataContext _ctx; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataServiceCollection&amp;lt;SuggestionsItem&amp;gt; _suggestions; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public TeamSiteDataContext DataContext &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_ctx == null) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _ctx = new TeamSiteDataContext( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Uri( &lt;BR&gt;http://mflasko-dev/_vti_bin/listdata.svc, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UriKind.Absolute &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _ctx; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public DataServiceCollection&amp;lt;SuggestionsItem&amp;gt; TrackedSuggestions &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_suggestions == null) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _suggestions = DataServiceCollection.CreateTracked&amp;lt;SuggestionsItem&amp;gt;(DataContext); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _suggestions; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This class has two properties, both evaluated on first access. &lt;/P&gt;
&lt;P&gt;One gets the DataServiceContext and the other gets a DataServiceCollection which will hold, and track changes to, a collection of Suggestions. &lt;/P&gt;
&lt;P&gt;The SuggestionContext is then exposed as a property of our Silverlight UserControl: &lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;private SuggestionContext _currentContext; &lt;BR&gt;public SuggestionContext CurrentContext { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_currentContext == null) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _currentContext = new SuggestionContext(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return _currentContext; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Next in the constructor of our UserControl we use this as the DataContext for our layout root, we call GetSuggestionsWithNoComments() to retrieve the interesting suggestions, and finally we hookup some event handlers for our buttons, so we can add a new suggestion and save any changes we make back to the database.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;public MainPage() &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; InitializeComponent(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetSuggestionsWithNoComments(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LayoutRoot.DataContext = CurrentContext; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.btnSaveChanges.Click += new RoutedEventHandler(SaveChanges_Click); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.btnNewSuggestion.Click += new RoutedEventHandler(AddNewSuggestion); &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The GetSuggestionsWithNoComments() method looks like this: &lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;public void GetSuggestionsWithNoComments() &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = ( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from suggestion in CurrentContext.DataContext.Suggestions &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where suggestion.Comments == null &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select suggestion &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) as DataServiceQuery&amp;lt;SuggestionsItem&amp;gt;; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.BeginExecute( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (IAsyncResult asyncResult) =&amp;gt; Dispatcher.BeginInvoke(() =&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataServiceQuery&amp;lt;SuggestionsItem&amp;gt; queryResults = asyncResult.AsyncState as DataServiceQuery&amp;lt;SuggestionsItem&amp;gt;; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (queryResults != null) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentContext.TrackedSuggestions.Clear(true); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentContext.TrackedSuggestions.Load( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryResults.EndExecute(asyncResult) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , query &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;It executes an asynchronous query to retrieve the interesting suggestions and load them into the CurrentContext.TrackedSuggestions collection. Which in turn causes the ListBox to fill, because of the data binding we’ve set up.&lt;/P&gt;
&lt;H4&gt;Step 2: Inserting, Editing and Deleting suggestions&lt;/H4&gt;
&lt;P&gt;Now in our XAML we’ve already setup two way data binding from our textboxes back to the suggestion selected in the ListBox, so as we make changes in the TextBoxes the Suggestion is modified, and those changes are tracked by the DataServiceCollection. &lt;/P&gt;
&lt;P&gt;So that covers Editing.&lt;/P&gt;
&lt;P&gt;Insert is handled by the ‘New Suggestion’ button. The event handler looks like this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;void AddNewSuggestion(object sender, RoutedEventArgs e) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentContext.TrackedSuggestions.Add( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new SuggestionsItem { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Title = "{Enter a title}", &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Description = "", &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Modified = DateTime.Now, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Created = DateTime.Now &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListBox.SelectedIndex = CurrentContext.TrackedSuggestions.Count - 1; &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;As you can see this creates a new Suggestion, adds it to the DataServiceCollection, and then tells the ListBox to select the new Suggestion so it can be modified via our TextBoxes.&lt;/P&gt;
&lt;P&gt;In our XAML we added a Delete button to each ListBoxItem, this event is bound to those buttons:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;private void DeleteSuggestion(object sender, RoutedEventArgs e) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Button b = sender as Button; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SuggestionsItem toDelete = b.Tag as SuggestionsItem; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentContext.TrackedSuggestions.Remove(toDelete); &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;This relies on the fact that when during DataBinding we put the Suggestion in the button’s Tag property, so all we do when the button is clicked, is retrieve the current Suggestion and remove the suggestion from the TrackedSuggestions collection. This is interpreted as a delete. &lt;/P&gt;
&lt;H4&gt;Step 3: Submitting your changes&lt;/H4&gt;
&lt;P&gt;Because we are using a DataServiceCollection, every Insert, Edit and Delete is automatically tracked for us. &lt;/P&gt;
&lt;P&gt;But as yet they haven’t been committed to the server.&lt;/P&gt;
&lt;P&gt;To do that you have to click the “Save Changes” button, which calls this code: &lt;BR&gt;&lt;BR&gt;&lt;FONT face="Courier New"&gt;void SaveChanges_Click(object sender, RoutedEventArgs e) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentContext.DataContext.BeginSaveChanges( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (IAsyncResult asyncResult) =&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispatcher.BeginInvoke( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; () =&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentContext.DataContext.EndSaveChanges(asyncResult); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetSuggestionsWithNoComments(); &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , CurrentContext &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ); &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;As per usual the request is invoked asynchronously, in this case by calling BeginSaveChanges. &lt;/P&gt;
&lt;P&gt;One thing to note is that once we’ve actually saved the changes we refresh the list of Suggestions by calling GetSuggestionsWithNoComments() again. &lt;/P&gt;
&lt;P&gt;The idea here is that once we’ve edited some suggestions they may not longer be interesting for us, or there maybe some new suggestions on the server.&lt;/P&gt;
&lt;H3&gt;Summary:&lt;/H3&gt;
&lt;P&gt;As you can see it is really easy to create a Silverlight application that uses Data Services to query and manipulate list data.&lt;/P&gt;
&lt;P&gt;In Part 3 we will cover how to interact with blobs (i.e. Documents, Images etc), and look&amp;nbsp;out for an upcoming&amp;nbsp;&lt;A href="http://blogs.msdn.com/astoriateam/archive/2009/11/05/enabling-x-domain-access-to-your-data-services.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/11/05/enabling-x-domain-access-to-your-data-services.aspx"&gt;blog post covering X-Domain Policy&lt;/A&gt; which is important if your Silverlight application isn’t hosted on the same web-server as Sharepoint.&lt;/P&gt;
&lt;P&gt;As always don’t hesitate to leave a comment.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/alexj" mce_href="http://blogs.msdn.com/alexj"&gt;&lt;STRONG&gt;Alex James&lt;/STRONG&gt;&lt;/A&gt; &lt;BR&gt;Program Manager Microsoft&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9914952" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author><category term="ADO.NET Data Services" scheme="http://blogs.msdn.com/astoriateam/archive/tags/ADO.NET+Data+Services/default.aspx" /><category term="Sharepoint" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Sharepoint/default.aspx" /><category term="Silverlight" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Silverlight/default.aspx" /><category term="How To" scheme="http://blogs.msdn.com/astoriateam/archive/tags/How+To/default.aspx" /><category term="What's New" scheme="http://blogs.msdn.com/astoriateam/archive/tags/What_2700_s+New/default.aspx" /></entry><entry><title>Using Data Services over SharePoint 2010 – Part 1 – Getting Started</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx</id><published>2009-10-21T18:21:00Z</published><updated>2009-10-21T18:21:00Z</updated><content type="html">&lt;P&gt;&lt;A href="http://blogs.msdn.com/adonet/archive/2009/09/01/ado-net-data-services-v1-5-ctp2-now-available.aspx" mce_href="http://blogs.msdn.com/adonet/archive/2009/09/01/ado-net-data-services-v1-5-ctp2-now-available.aspx"&gt;ADO.NET Data Services 1.5&lt;/A&gt; and &lt;A href="http://sharepoint.microsoft.com/" mce_href="http://sharepoint.microsoft.com"&gt;SharePoint 2010&lt;/A&gt; allow developers to write applications against SharePoint Lists using the familiar Data Services Client programming model. &lt;/P&gt;
&lt;H3&gt;Setup&lt;/H3&gt;
&lt;P&gt;The SharePoint 2010 beta will become generally available in &lt;A href="http://www.microsoft.com/presspass/press/2009/oct09/10-19MSSharePointConf09PR.mspx" mce_href="http://www.microsoft.com/presspass/press/2009/oct09/10-19MSSharePointConf09PR.mspx"&gt;November&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;In order to use Data Services with SharePoint 2010 Beta, ADO.NET Data Services 1.5 must be installed on your server *before* you install SharePoint 2010&lt;/P&gt;
&lt;P&gt;And then to program against a Data Services enabled SharePoint box you need either:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;VS 2008 SP1 with the ADO.NET Data Services 1.5 installed (&lt;A href="http://blogs.msdn.com/adonet/archive/2009/09/01/ado-net-data-services-v1-5-ctp2-now-available.aspx" mce_href="http://blogs.msdn.com/adonet/archive/2009/09/01/ado-net-data-services-v1-5-ctp2-now-available.aspx"&gt;CTP 2&lt;/A&gt; or higher) &lt;BR&gt;&lt;BR&gt;or &lt;BR&gt;&lt;/LI&gt;
&lt;LI&gt;VS 2010 (&lt;A href="http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx" mce_href="http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx"&gt;Beta 2&lt;/A&gt; or higher) &lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Where is your Data Service Endpoint?&lt;/H3&gt;
&lt;P&gt;Assuming you’ve got everything setup and working the first thing you need to know is where your Data Service endpoint is installed.&lt;/P&gt;
&lt;P&gt;If your SharePoint site is &lt;STRONG&gt;http://mflasko-dev/&lt;/STRONG&gt; (thanks Mike) then your Data Services endpoint will be &lt;STRONG&gt;http://mflasko-dev/_vti_bin/listdata.svc&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;If you open one of these endpoints up in Internet Explorer you’ll see something like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/DataServiceRoot.jpg" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/DataServiceRoot.jpg"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=DataServiceRoot border=0 alt=DataServiceRoot src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/DataServiceRoot_thumb.jpg" width=226 height=244 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/DataServiceRoot_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;As you can see this is a standard Data Services Atom feed, listing all the Lists on the SharePoint site.&lt;/P&gt;
&lt;P&gt;Cool.&lt;/P&gt;
&lt;P&gt;Once you know where your Data Service is located, the next step is to write your Data Services Client application.&lt;/P&gt;
&lt;H3&gt;Create the Sharepoint Application:&lt;/H3&gt;
&lt;P&gt;But first to demonstrate how easy this is, I’ve used SharePoint to create the simplest of all Suggestion Tracking applications. &lt;/P&gt;
&lt;P&gt;You can follow along by following these simple steps:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a ‘Suggestions’ list which is based on an ‘Issues’ list. &lt;/LI&gt;
&lt;LI&gt;Finished! &lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;The resulting list looks something like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/Suggestions.jpg" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/Suggestions.jpg"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=Suggestions border=0 alt=Suggestions src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/Suggestions_thumb.jpg" width=244 height=35 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/Suggestions_thumb.jpg"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The idea is that this list will capture all the suggestions users have for making a departmental line of business (LOB) application better. &lt;/P&gt;
&lt;P&gt;But rather than making people go to the SharePoint site to make the suggestion, we want to allow the users to do it right in the LOB application.&lt;/P&gt;
&lt;H3&gt;Talking to Sharepoint using Data Services:&lt;/H3&gt;
&lt;P&gt;The first step as always to add a service reference, using the location of the Data Service that exposes SharePoint data (i.e. &lt;STRONG&gt;http://mflasko-dev/_vti_bin/listdata.svc&lt;/STRONG&gt;)&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/AddServiceReference.jpg" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/AddServiceReference.jpg"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=AddServiceReference border=0 alt=AddServiceReference src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/AddServiceReference_thumb.jpg" width=244 height=198 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/AddServiceReference_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Once you’ve done this you will have CLR classes representing the types in each list, and you will have a strongly typed DataServiceContext called TeamSiteDataContext that allows you to access the data:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/ObjectBrowser.jpg" mce_href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/ObjectBrowser.jpg"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=ObjectBrowser border=0 alt=ObjectBrowser src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/ObjectBrowser_thumb.jpg" width=158 height=244 mce_src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/UsingDataServicesoverSharepoint2010_A5DF/ObjectBrowser_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Rather than focusing on how the user enters the suggest in your LOB application, lets focus on how to POST that suggestion to Sharepoint. &lt;/P&gt;
&lt;P&gt;To do that you need to write a method something like this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;public void PostSuggestion(string title, string description) &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp; TeamSiteDataContext ctx = new TeamSiteDataContext( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Uri( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;http://mflasko-dev/_vti_bin/listdata.svc&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;,&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UriKind.Absolute &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) &lt;BR&gt;&amp;nbsp;&amp;nbsp; ); &lt;BR&gt;&amp;nbsp;&amp;nbsp; ctx.AddToSuggestions( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new SuggestionsItem{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Title = title,&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Description = description &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;BR&gt;&amp;nbsp;&amp;nbsp; ); &lt;BR&gt;&amp;nbsp;&amp;nbsp; ctx.SaveChanges(); &lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;As you can see this is very easy.&lt;/P&gt;
&lt;P&gt;In an environment like Silverlight it is a little more complicated because whenever you cross a network boundary have to deal with the Async and Threading issues. Which means you can’t use SaveChanges() directly.&lt;/P&gt;
&lt;P&gt;You have to use the standard BeginXXX() and EndXXX() async pattern and you need to use the Dispatcher to ensure the results are marshaled back on the UI thread:&lt;/P&gt;&lt;FONT face="Courier New"&gt;
&lt;P&gt;ctx.BeginSaveChanges( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (IAsyncResult result) =&amp;gt; Dispatcher.BeginInvoke( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; () =&amp;gt; ctx.EndSaveChanges(result)), &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ctx &lt;BR&gt;&amp;nbsp;&amp;nbsp; );&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;In future blog posts we will dig into this in more detail, covering topic like Query / Update / Data Binding, Blob Handling and security policies over Sharepoint.&lt;/P&gt;
&lt;P&gt;As always we are keen to hear your comments.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A href="http://blogs.msdn.com/alexj" mce_href="http://blogs.msdn.com/alexj"&gt;Alex James&lt;/A&gt; &lt;BR&gt;&lt;/STRONG&gt;Program Manager &lt;BR&gt;Microsoft&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9910793" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author><category term="ADO.NET Data Services" scheme="http://blogs.msdn.com/astoriateam/archive/tags/ADO.NET+Data+Services/default.aspx" /><category term="Sharepoint" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Sharepoint/default.aspx" /><category term="Silverlight" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Silverlight/default.aspx" /><category term="How To" scheme="http://blogs.msdn.com/astoriateam/archive/tags/How+To/default.aspx" /><category term="What's New" scheme="http://blogs.msdn.com/astoriateam/archive/tags/What_2700_s+New/default.aspx" /></entry><entry><title>Share your data across data sources (Sharepoint, SQL Server, Azure, Reporting Services, etc) &amp; applications (.NET, Silverlight, Excel, etc) using Data Services</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/10/19/share-your-data-across-data-sources-sharepoint-sql-server-azure-reporting-services-etc-applications-net-silverlight-excel-etc-using-data-services.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/10/19/share-your-data-across-data-sources-sharepoint-sql-server-azure-reporting-services-etc-applications-net-silverlight-excel-etc-using-data-services.aspx</id><published>2009-10-20T03:32:00Z</published><updated>2009-10-20T03:32:00Z</updated><content type="html">&lt;p&gt;This week at the &lt;a href="http://www.mssharepointconference.com/" mce_href="http://www.mssharepointconference.com/"&gt;SharePoint conference&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/pablo/" mce_href="http://blogs.msdn.com/pablo/"&gt;Pablo Castro&lt;/a&gt; will be announcing that the next version of SharePoint natively integrates with data services such that all SharePoint lists will be exposed as an &lt;a href="http://msdn.microsoft.com/en-us/data/aa937699.aspx" mce_href="http://msdn.microsoft.com/en-us/data/aa937699.aspx"&gt;ADO.NET&lt;/a&gt; Data Service.&amp;nbsp; This means you can now program against SharePoint list data using all the VS tools and runtime client libraries (.NET, Silverlight, &lt;a href="http://aspnet.codeplex.com/wikipage?title=AJAX&amp;amp;referringTitle=Home" mce_href="http://aspnet.codeplex.com/wikipage?title=AJAX&amp;amp;referringTitle=Home"&gt;AJAX&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/29/restlet-java-framework-now-with-ado-net-data-services-support.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/09/29/restlet-java-framework-now-with-ado-net-data-services-support.aspx"&gt;Java&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/08/jumpstart-your-php-ado-net-data-services-development.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/09/08/jumpstart-your-php-ado-net-data-services-development.aspx"&gt;PHP&lt;/a&gt;, etc…) which support &lt;a href="http://msdn.microsoft.com/en-us/data/aa937699.aspx" mce_href="http://msdn.microsoft.com/en-us/data/aa937699.aspx"&gt;ADO.NET&lt;/a&gt; Data Services.&amp;nbsp; Also, since the Data Service interface is just plain HTTP and XML/Atom or JSON, pretty much any environment with an HTTP stack can now browse, update and interact with list and document data in SharePoint. We are very excited to be able to talk about SharePoint’s data service integration (more code-centric blogs to come on this topic) as this has been an ask we hear a lot each time we present data services. &lt;/p&gt;  &lt;p&gt;This integration is also a good example of a step towards our larger vision for data services and, more generally, open data access on the web.&amp;nbsp; The remainder of this post outlines our roadmap around data services and what parts of that roadmap we are announcing this week.&lt;/p&gt;    &lt;h3&gt;First, a bit of context…&lt;/h3&gt;  &lt;p&gt;Successful applications collect lots of valuable data. Often it is relatively easy to get data into applications but hard to get it out or to have multiple applications to use one another’s data. Part of the problem is lack of a simple, uniform way of exchanging data across systems. Server side applications such as SharePoint server are examples where it would be extremely valuable to have a general purpose data service interface. Another example is SQL Server Reporting Services, as reports frequently become the official entry point for application data. Excel and the analysis services clients in SQL Server are examples of client side applications that would greatly benefit from having readily access to data managed by applications of all kinds, from SharePoint sites to Reporting Services reports in existing applications to custom applications that expose data as services. Client mash-ups also consolidate data from multiple sources to provide valuable cross-application perspective, provided that they can actually access data from all systems. &lt;/p&gt;  &lt;h3&gt;Background on the approach&lt;/h3&gt;  &lt;p&gt;Services, instead of APIs, is what is becoming common ground for interaction across tiers or across applications, both on the web and inside organizations. Microsoft has been working on data-centric service interfaces that enable simple, effective data sharing within and across applications. The first materialization of this effort is the &lt;a href="http://msdn.microsoft.com/en-us/data/aa937699.aspx" mce_href="http://msdn.microsoft.com/en-us/data/aa937699.aspx"&gt;ADO.NET&lt;/a&gt; Data Services framework that shipped last year as part of .NET 3.5 SP1. The approach taken is to use a RESTful data service interface built on top of standard, broadly available concepts and technologies such as HTTP and &lt;a href="http://tools.ietf.org/html/rfc5023" mce_href="http://tools.ietf.org/html/rfc5023"&gt;AtomPub&lt;/a&gt;. Conventions are defined on top such that things such as metadata discovery is possible&lt;/p&gt;  &lt;h3&gt;What we are announcing&lt;/h3&gt;  &lt;p&gt;A number of products and developer tools are all now aligned around this single RESTful data service interface. More specifically: &lt;/p&gt;  &lt;h4&gt;&lt;b&gt;Developer tools: &lt;/b&gt;&lt;/h4&gt; &lt;b&gt;&lt;/b&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;We updated the protocol itself as well as our frameworks and developer tools in Visual Studio 2010, .NET 4.0 (starting with Beta 2) and Silverlight 4.&amp;nbsp; We’ll also release an &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx"&gt;update to .NET 3.5 SP1&lt;/a&gt;. &lt;/p&gt;  &lt;h4&gt;SharePoint: &lt;/h4&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/presspass/press/2009/oct09/10-19MSSharePointConf09PR.mspx" mce_href="http://www.microsoft.com/presspass/press/2009/oct09/10-19MSSharePointConf09PR.mspx"&gt;Starting with SharePoint 2010&lt;/a&gt; (beta release to come in November) all SharePoint sites are automatically exposed as RESTful data services that follow the &lt;a href="http://msdn.microsoft.com/en-us/data/aa937699.aspx" mce_href="http://msdn.microsoft.com/en-us/data/aa937699.aspx"&gt;ADO.NET&lt;/a&gt; Data Services convention. Now any client with an HTTP stack can read and write to SharePoint by just using simple HTTP methods and Atom (XML) or JSON formatted data. All the rich clients that work with Data Services will work with SharePoint out of the box. &lt;/p&gt;  &lt;h4&gt;&lt;b&gt;Reporting Services: &lt;/b&gt;&lt;/h4&gt;  &lt;p&gt;Starting with SQL Server 2008 R2, all reports created with SQL Server Reporting Services will expose an option to render as an Atom feed that follows the Data Services convention as well. This makes it possible for developers and information workers to see the data “underneath” a report (whether it displays as tables, charts, etc.) and use it in their own applications. &lt;/p&gt;  &lt;h4&gt;&lt;b&gt;Excel and Microsoft SQL Server PowerPivot for Excel 2010 (aka “Project Gemini”):&lt;/b&gt;&lt;/h4&gt;  &lt;p&gt;Also starting with SQL Server 2008 R2, &lt;a href="http://www.powerpivot.com/" mce_href="http://www.powerpivot.com/"&gt;the PowerPivot plug-in for Excel&lt;/a&gt; allows information workers to bring data from all sources for analysis will natively understand and load data from any Data Service. Now information workers can obtain data from reports, SharePoint sites, public sites that expose reference data and even custom applications and load it directly into the data analysis environments. &lt;/p&gt;  &lt;h4&gt;&lt;b&gt;Cross-platform clients:&lt;/b&gt; &lt;/h4&gt;  &lt;p&gt;in addition to the &lt;a href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" mce_href="http://msdn.microsoft.com/en-us/data/bb931106.aspx"&gt;.NET, Silverlight&lt;/a&gt; and &lt;a href="http://aspnet.codeplex.com/wikipage?title=AJAX&amp;amp;referringTitle=Home" mce_href="http://aspnet.codeplex.com/wikipage?title=AJAX&amp;amp;referringTitle=Home"&gt;AJAX&lt;/a&gt; clients that were already available, Microsoft sponsored open-source projects to create a &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/08/jumpstart-your-php-ado-net-data-services-development.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/09/08/jumpstart-your-php-ado-net-data-services-development.aspx"&gt;PHP&lt;/a&gt; and a &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/29/restlet-java-framework-now-with-ado-net-data-services-support.aspx" mce_href="http://blogs.msdn.com/astoriateam/archive/2009/09/29/restlet-java-framework-now-with-ado-net-data-services-support.aspx"&gt;Java&lt;/a&gt; client for Data Services. Both are already publicly available. &lt;/p&gt;  &lt;p&gt;All these products introduce first class support for producing or consuming the Data Services protocol, enabling data sharing scenarios for both developers and information workers. They join other already-existing services using the Data Services protocol such as the Windows Azure Table Store. &lt;/p&gt;  &lt;p&gt;Stay tuned, more to come at the &lt;a href="http://microsoftpdc.com/" mce_href="http://microsoftpdc.com/"&gt;PDC&lt;/a&gt; &amp;amp; &lt;a href="http://www.microsoft.com/europe/teched/" mce_href="http://www.microsoft.com/europe/teched/"&gt;TechEd&lt;/a&gt; conferences later this year. &lt;/p&gt;    &lt;p&gt;&lt;b&gt;Mike Flasko&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ADO.NET Data Services, Lead Program Manager &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9909638" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author><category term="ADO.NET Data Services" scheme="http://blogs.msdn.com/astoriateam/archive/tags/ADO.NET+Data+Services/default.aspx" /><category term="Azure" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Azure/default.aspx" /><category term="Excel" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Excel/default.aspx" /><category term="Sharepoint" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Sharepoint/default.aspx" /><category term="Silverlight" scheme="http://blogs.msdn.com/astoriateam/archive/tags/Silverlight/default.aspx" /></entry><entry><title>ADO.NET Data Services – Version Headers</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/10/07/ado-net-data-services-version-headers.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/10/07/ado-net-data-services-version-headers.aspx</id><published>2009-10-08T09:37:47Z</published><updated>2009-10-08T09:37:47Z</updated><content type="html">&lt;p&gt;Peter Qian, a developer on the data services team, has posted a two part series on the versioning headers used by ADO.NET Data Services to ensure a client or server never misinterprets a payload or URI.&amp;#160; You can check out his posts here:&lt;/p&gt;  &lt;p&gt;Part 1 - &lt;a title="Versioning Protocol of Astoria" href="http://blogs.msdn.com/peter_qian/archive/2009/04/02/versioning-protocol-of-astoria.aspx"&gt;Versioning Protocol of Astoria&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Part 2 - &lt;a title="Versioning Protocol of Astoria II" href="http://blogs.msdn.com/peter_qian/archive/2009/09/28/versioning-protocol-of-astoria-ii.aspx"&gt;Versioning Protocol of Astoria II&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;-Mike Flasko&lt;/p&gt;  &lt;p&gt;ADO.NET Data Services, Program Manager&amp;#160; &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9904750" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry><entry><title>‘Restlet’ Java Framework Now with ADO.NET Data Services Support</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/09/29/restlet-java-framework-now-with-ado-net-data-services-support.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/09/29/restlet-java-framework-now-with-ado-net-data-services-support.aspx</id><published>2009-09-29T18:27:08Z</published><updated>2009-09-29T18:27:08Z</updated><content type="html">&lt;p&gt;Yesterday on the interoperability blog it was &lt;a href="http://blogs.msdn.com/interoperability/archive/2009/09/28/new-bridge-broadens-java-and-net-interoperability.aspx"&gt;announced&lt;/a&gt; that &lt;a href="http://blog.noelios.com/2009/09/28/restlet-2-0-m5-now-available/"&gt;Noelios Technologies&lt;/a&gt; is shipping a new version of the Restlet open source project (a lightweight REST framework for Java) that includes an extension for ADO.NET Data Services.&amp;#160; &lt;/p&gt;  &lt;p&gt;This is the second interoperability project over the last month or so which leverages data services. Prior to this, the interoperability team announced the release of a &lt;a href="http://blogs.msdn.com/interoperability/archive/2009/08/21/a-new-bridge-for-php-developers-to-net-through-rest-php-toolkit-for-ado-net-data-services.aspx"&gt;PHP toolkit for data services&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;For a complete list of interoperability bridges available (which target data services and other technologies), check out this URL: &lt;a title="http://www.interoperabilitybridges.com/" href="http://www.interoperabilitybridges.com/"&gt;http://www.interoperabilitybridges.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;--Mike Flasko&lt;/p&gt;  &lt;p&gt;ADO.NET Data Services, Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9900839" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry><entry><title>Introduction to Data Binding in Silverlight 3 with CTP2</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/09/17/introduction-to-data-binding-in-silverlight-3-with-ctp2.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/09/17/introduction-to-data-binding-in-silverlight-3-with-ctp2.aspx</id><published>2009-09-18T04:18:29Z</published><updated>2009-09-18T04:18:29Z</updated><content type="html">&lt;p&gt;This blog post is an introduction to the data binding capabilities for Silverlight 3 we first added for Silverlight 2 in Data Services v1.5 CTP1 and have updated to Silverlight 3 in CTP2. We also took the feedback we received in CTP1 and made some updates to the feature. Since this is a CTP release of this is a CTP release of this feature we eagerly look forward to hearing your feedback.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Introduction to Data Binding&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;In a previous &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx"&gt;post&lt;/a&gt; I introduced a new feature we included in ADO.NET Data Services v1.5 CTP2 that enables data binding. I outlined the feature and then showed how it can be used in WPF to create a client application that uses two-way data binding with WPF controls. The following blog post is a variance on the first blog post that shows how a similar application can be created using Silverlight 3. For more information on the new binding feature, you should go read the introduction to that post; found &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Walkthrough&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The following is a walkthrough of using data binding in a Silverlight 3 application. &lt;/p&gt;  &lt;p&gt;To get started, you'll want to download all of the required software I use in the walkthrough:&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Visual Studio 2008 SP1 (&lt;a href="http://msdn.microsoft.com/en-us/vs2008/products/cc268305.aspx"&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;ADO.NET Data Services v1.5 CTP2 (&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=a71060eb-454e-4475-81a6-e9552b1034fc&amp;amp;displaylang=en"&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;Silverlight 3 SDK (&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=2050E580-F1D5-4040-BB09-E6185591B6B5&amp;amp;displaylang=en"&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;Silverlight tools for Visual Studio SP1 (&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=9442B0F2-7465-417A-88F3-5E7B5409E9DD&amp;amp;displaylang=en"&gt;here&lt;/a&gt;) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;Step 1 and 2&lt;/b&gt;: Create an ADO.NET Data Service v1.5&lt;/p&gt;  &lt;p&gt;The service you will use for this walkthrough is identical to the service I created in my introduction to databinding and WPF. For this step, go to &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx"&gt;this&lt;/a&gt; blog post and follow step 1 and 2 of the walkthrough and then come back here and continue with step 3.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Step 3&lt;/b&gt;: Create client proxy code with binding enabled.&lt;/p&gt;  &lt;p&gt;After setting the environment variable in step 2, open the solution you created in step 1 and create a new Silverlight project.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_thumb.png" width="396" height="295" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Once you have created a SL client project, the next step is to generate client side types. To do this, find the DatabindingSLClient project in the solution explorer, right-click the project and select &lt;i&gt;Add Service Reference... &lt;/i&gt;In the Add Service Reference dialog, click the &lt;i&gt;Discover&lt;/i&gt; button. The northwind.svc service will show up in the &lt;i&gt;Service&lt;/i&gt; window. Enter NorthwindService as the Namespace value and select OK. This wizard will generate a set of client side types that can be used to interact with the service created in step 1.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_thumb_1.png" width="316" height="295" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If this step is done correctly, you will see a new NorthwindService node under the Service References Node in the solution explorer. As well, you will see a reference to Microsoft.Data.Services.Client in the references node; if you do not see the reference to Microsoft.Data.Services.Client or you see a reference to System.Data.Services.Client go to the ADO.NET Data Services blog and read &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx"&gt;this&lt;/a&gt; post about enabling ADO.NET Data Services v1.5 features in Visual Studio and then repeat the Add Service Reference Step.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/clip_image006_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/clip_image006_thumb.jpg" width="205" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When the above references are correctly showing the Silverlight project, right click the Microsoft.Data.Services.Client reference and select &lt;i&gt;Properties&lt;/i&gt;. In the properties window, change the Copy Local property to &lt;i&gt;True&lt;/i&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/clip_image008_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/clip_image008_thumb.jpg" width="246" height="283" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The next part of this step is to create a new instance of the ADO.NET Data Services client context and connect to the service created in step 1. To do this, add the following code to the Page.xaml.cs file to create a connection to the service.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4273bc99-91ff-43b2-a601-0b2e6e9ff609" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#2b91af"&gt;NorthwindEntities&lt;/span&gt; nwsvc = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;NorthwindEntities&lt;/span&gt;(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color:#a31515"&gt;"/Northwind.svc"&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;UriKind&lt;/span&gt;.Relative));&lt;br&gt; &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; MainPage()&lt;br&gt; {&lt;br&gt;     InitializeComponent();&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Now, create an interface that you can bind the result of a query to. The service you created in step 1 exposes a set of Suppliers and a set of Products from the Northwind database with a one-to-many relationship between them. The XAML code below will create a datagrid to display the suppliers. It will also create a RowDetailsTemplate inside each row of the datagrid to display the supplier’s products. This type of binding is called master-detail binding. &lt;/p&gt;  &lt;p&gt;The code below uses standard Silverlight binding semantics. The columns of the supplier datagrid are each bound to a property of the supplier object through the Binding=&amp;quot;{Binding ProductID}&amp;quot;tag. &lt;/p&gt;  &lt;p&gt;Paste the following code snippet into the mainPage.xaml file:&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0e06e514-3bc3-47b7-a98f-b52614171dd7" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid&lt;/span&gt;&lt;span style="color:#ff0000"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="supplierGrid"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Background&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="White"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="750"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="400"&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid&lt;/span&gt;&lt;span style="color:#ff0000"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="dgSuppliers"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="300"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="749"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; AutoGenerateColumns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="False"&lt;/span&gt;&lt;br&gt;               &lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Top"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; RowDetailsVisibilityMode&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="VisibleWhenSelected"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; RowDetailsVisibilityChanged&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="dgSuppliers_RowDetailsVisibilityChanged"&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid.RowDetailsTemplate&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid&lt;/span&gt;&lt;span style="color:#ff0000"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="dgSupplierProduct"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="700"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; AutoGenerateColumns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="False"&lt;/span&gt;&lt;br&gt;                             &lt;span style="color:#ff0000"&gt; HeadersVisibility&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Column"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Right"&lt;/span&gt;&lt;br&gt;                             &lt;span style="color:#ff0000"&gt; SelectionChanged&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="dgSupplierProduct_SelectionChanged"&lt;/span&gt;&lt;br&gt;                               &lt;span style="color:#ff0000"&gt; ItemsSource&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Products&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="ID"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; ProductID&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Name"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; ProductName&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="QuantityPerUnit"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; QuantityPerUnit&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Price"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; UnitPrice&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="InStock"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; UnitsInStock&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid.RowDetailsTemplate&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="ID"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=SupplierID}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Name"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=CompanyName}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Address"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=Address}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="City"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=City}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Region"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=Region}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;data&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#a31515"&gt;DataGrid&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Edit the following attributes of your window: Width=&amp;quot;750&amp;quot; Height=&amp;quot;400&amp;quot; to properly display the controls.&lt;/p&gt;  &lt;p&gt;The next step to enable binding to these Silverlight controls is to set the ItemsSource of the datagrid in the page you just created to the result of a query for suppliers from the service created in step 1. This is done by executing an asynchronous ADO.NET Data Services query on the context for the set of suppliers and loading the query result into a DataServiceCollection. The entities in this collection will implement INotifyPropertyChanged and INotifyCollectionChanged. To do this, add the following code to the constructor for the page:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2f543aaa-aef7-4794-a05b-20dacb3e94bf" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; MainPage()&lt;br&gt; {&lt;br&gt;     InitializeComponent();&lt;br&gt;     &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; q = nwsvc.Suppliers;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;//create an asynchronous query to get the set of suppliers&lt;/span&gt;&lt;br&gt;     q.BeginExecute(&lt;br&gt;             &lt;span style="color:#0000ff"&gt;delegate&lt;/span&gt; (&lt;span style="color:#2b91af"&gt;IAsyncResult&lt;/span&gt; asyncResult)&lt;br&gt;             {&lt;br&gt;                 Dispatcher.BeginInvoke(&lt;br&gt;                     () =&amp;gt;&lt;br&gt;                         {&lt;br&gt;                             &lt;span style="color:#2b91af"&gt;DataServiceQuery&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt;&amp;gt; query = asyncResult.AsyncState &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af"&gt;DataServiceQuery&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt;&amp;gt;;&lt;br&gt;                             &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (query != &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;)&lt;br&gt;                             {&lt;br&gt;                                 &lt;span style="color:#008000"&gt;//create a tracked DataServiceCollection from the result of the asynchronous query.&lt;/span&gt;&lt;br&gt;                                 suppliers = &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;.CreateTracked&amp;lt;&lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt;&amp;gt;(nwsvc, query.EndExecute(asyncResult));&lt;br&gt;                                 &lt;span style="color:#008000"&gt;//set the items source of the grid to the DataServiceCollection of suppliers. This collection&lt;/span&gt;&lt;br&gt;                                 &lt;span style="color:#008000"&gt;//will be tracked and all changes made will be reflected on the DataServiceContext&lt;/span&gt;&lt;br&gt;                                 &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.dgSuppliers.ItemsSource = suppliers;&lt;br&gt;                             }&lt;br&gt;                         }&lt;br&gt;                     );&lt;br&gt;             },&lt;br&gt;             q   &lt;br&gt;         );&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt; &lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/clip_image014_2.jpg"&gt;&lt;/a&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The final step is to implement the RowDetailsVisibilityChanged event handler that executes when a new row is selected in the grid. This method will dynamically load in the products to display in-line for the currently selected supplier using a call to loadProperty. Insert the following code into the event handler:&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a6df3f51-2136-4d78-8b67-e280058e2cca" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; dgSuppliers_RowDetailsVisibilityChanged(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;DataGridRowDetailsEventArgs&lt;/span&gt; e)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (e.Row.DataContext &lt;span style="color:#0000ff"&gt;is&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt;)&lt;br&gt;     {&lt;br&gt;         &lt;span style="color:#008000"&gt;//get the currently selected item in the grid&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt; supplier = e.Row.DataContext &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt;;&lt;br&gt; &lt;br&gt;         &lt;span style="color:#008000"&gt;//ensure the entity is not new or we won't be able to query for it's products&lt;/span&gt;&lt;br&gt;         &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (nwsvc.GetEntityDescriptor(supplier).State != &lt;span style="color:#2b91af"&gt;EntityStates&lt;/span&gt;.Added)&lt;br&gt;         {&lt;br&gt;             &lt;span style="color:#008000"&gt;//create an async call to load the products property of the current supplier&lt;/span&gt;&lt;br&gt;             Dispatcher.BeginInvoke(&lt;br&gt;                 () =&amp;gt;&lt;br&gt;                 {&lt;br&gt;                     nwsvc.BeginLoadProperty(supplier, &lt;span style="color:#a31515"&gt;"Products"&lt;/span&gt;,&lt;br&gt;                         &lt;span style="color:#0000ff"&gt;delegate&lt;/span&gt;(&lt;span style="color:#2b91af"&gt;IAsyncResult&lt;/span&gt; asyncResult)&lt;br&gt;                         {&lt;br&gt;                             &lt;span style="color:#008000"&gt;//this delegate will execute when the results of the async query have returned&lt;/span&gt;&lt;br&gt;                             nwsvc.EndLoadProperty(asyncResult);&lt;br&gt; &lt;br&gt;                         }, supplier);&lt;br&gt;                 }&lt;br&gt;             );&lt;br&gt;         }&lt;br&gt;     }&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Once this is complete, compile the project and run it. This datagrid in this example takes advantage of the RowDetailsTemplate in Silverlight to display the products directly inline when a supplier is selected. The result will be:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_thumb_2.png" width="650" height="268" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Step 4: Two-way Binding&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Up to this point in the walkthrough, you have created a Silverlight client and bound the result of a query to the service to a pair of listview controls in the client. This type of binding you have done so far has all been one-way binding. The DataServiceCollection you used at the end of step 3 also supports two-way binding. This means that any changes made to the collection or items in the collection will propagate to the service after a call to BeginSaveChanges() has completed executing. &lt;/p&gt;  &lt;p&gt;This final step will walk you through adding buttons that will add items to the collection of products and take advantage of two-way binding to have those changes propagate to the service and the backing northwind database.&lt;/p&gt;  &lt;p&gt;To start, add the following XAML code to the window1.xaml file to create two buttons to that will add a product from the list of products and save the changes to the service.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:31bb178d-0e13-460e-b123-1fa9e191cb82" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="saveBtn"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="90"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="25"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="600, 315, 50, 50"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Click&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="saveBtn_Click"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Content&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Save"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="addProductBtn"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="90"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="25"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="400, 315, 50, 50"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Click&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="addProductBtn_Click"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Content&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Add Product"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="addSupplierBtn"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="90"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="25"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="200, 315, 50, 50"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Click&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="addSupplierBtn_Click"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Content&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Add Supplier"&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;After adding this code the client application will be: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_10.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginSilverlight3a_DB28/image_thumb_4.png" width="576" height="271" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The final part of this step is to handle the add and save button click events. &lt;/p&gt;  &lt;p&gt;Add the following code to the add supplier buttons click event. This method will create a new supplier object and add it to the collection of suppliers.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1be1010f-1ebb-49d5-b64c-1b303f780d27" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; addSupplierBtn_Click(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;RoutedEventArgs&lt;/span&gt; e)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#008000"&gt;//create a new supplier and add it to the supplier collection&lt;/span&gt;&lt;br&gt;     suppliers.Add(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt;());&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Add the following code to the addProductBtn_Click event to create a new product when the add button is selected. The following code creates a new Product object and adds it to the list of products for the currently selected supplier. &lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ae691f06-953d-4e41-8ef3-529f21e89a22" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; addProductBtn_Click(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;RoutedEventArgs&lt;/span&gt; e)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#008000"&gt;//get the currently selected supplier entity&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt; supplier = &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.dgSuppliers.SelectedItem &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Supplier&lt;/span&gt;;&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;//add a new product to the supplier&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#008000"&gt;//because the collection of products is a tracked collection this operation&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#008000"&gt;//will be translated into an insert operation on the DataServiceContext&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (supplier != &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;)&lt;br&gt;         supplier.Products.Add(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Product&lt;/span&gt;());&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Add the following code to handle the save button click. This button calls BeginSaveChanges on the context which will cause any operations that have been performed on the context to be sent to the service. As with all network calls in Silverlight the SaveChanges call need to be asynchronous.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e6f219c4-ac2a-473d-9cbb-0cfcd2eb59ff" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; saveBtn_Click(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;RoutedEventArgs&lt;/span&gt; e)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#008000"&gt;//create an asynchronous save call&lt;/span&gt;&lt;br&gt;     nwsvc.BeginSaveChanges(&lt;span style="color:#2b91af"&gt;SaveChangesOptions&lt;/span&gt;.Batch,&lt;br&gt;         &lt;span style="color:#0000ff"&gt;delegate&lt;/span&gt;(&lt;span style="color:#2b91af"&gt;IAsyncResult&lt;/span&gt; asyncResult)&lt;br&gt;         {&lt;br&gt;             Dispatcher.BeginInvoke(&lt;br&gt;                 () =&amp;gt;&lt;br&gt;                 {&lt;br&gt;                     nwsvc.EndSaveChanges(asyncResult);&lt;br&gt;                 }&lt;br&gt;                 );&lt;br&gt;         }, nwsvc&lt;br&gt;         );&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Your project is now complete. When you make a change you then click the save button to persist the changes to the service.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Providing Feedback&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;We have created a new forum dedicated to providing feedback on &amp;quot;pre-release&amp;quot; versions of data services such as this CTP.&amp;#160; Please direct all your questions and comments about this feature this new forum which is available at: (&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/dataservices/threads"&gt;http://social.msdn.microsoft.com/Forums/en-US/dataservices/threads&lt;/a&gt;).&amp;#160; &lt;/p&gt;  &lt;p&gt;Note: The forum intended for questions on currently shipping versions of ADO.NET Data Services is still available at: &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/threads/"&gt;(http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/threads/&lt;/a&gt; )&lt;/p&gt;  &lt;p&gt;We look forward to hearing your feedback.&lt;/p&gt;  &lt;p&gt;Shayne Burgess&lt;/p&gt;  &lt;p&gt;ADO.NET Data Services, Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9896607" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry><entry><title>More on Using Data Services &amp; Silverlight 3 in xDomain &amp; Out-Of-Browser Scenarios</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/09/10/more-on-using-data-services-silverlight-3-in-xdomain-out-of-browser-scenarios.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/09/10/more-on-using-data-services-silverlight-3-in-xdomain-out-of-browser-scenarios.aspx</id><published>2009-09-10T18:18:45Z</published><updated>2009-09-10T18:18:45Z</updated><content type="html">&lt;p&gt;Phani recently posted part 2 of his two part series on using the ADO.NET Data Services v1.5 CTP2 Silverlight client library in xdomain and out-of-browser scenarios.&amp;#160; You can find both posts here:&lt;/p&gt;  &lt;p&gt;Part 1: &lt;a title="Using the ADO.NET Data Services Silverlight client in x-domain and out of browser scenarios – I" href="http://blogs.msdn.com/astoriateam/archive/2009/09/03/using-the-ado-net-data-services-silverlight-client-in-x-domain-and-out-of-browser-scenarios-i.aspx"&gt;Using the ADO.NET Data Services Silverlight client in x-domain and out of browser scenarios – I&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Part 2: &lt;a href="http://blogs.msdn.com/phaniraj/archive/2009/09/10/using-the-ado-net-data-services-silverlight-client-library-in-x-domain-and-out-of-browser-scenarios-ii-forms-authentication.aspx"&gt;Using the ADO.NET Data Services Silverlight client library in x-domain and out of browser scenarios – II (Forms Authentication)&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;-Mike Flasko&lt;/p&gt;  &lt;p&gt;ADO.NET Data Services, Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9893691" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry><entry><title>Jumpstart your PHP + ADO.NET Data Services Development</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/09/08/jumpstart-your-php-ado-net-data-services-development.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/09/08/jumpstart-your-php-ado-net-data-services-development.aspx</id><published>2009-09-09T07:21:01Z</published><updated>2009-09-09T07:21:01Z</updated><content type="html">&lt;p&gt;To get up and running quickly with the PHP toolkit for data services check out this walkthrough post by Phani from the data services team: &lt;a href="http://blogs.msdn.com/phaniraj/archive/2009/09/08/using-the-php-toolkit-with-ado-net-data-services.aspx"&gt;http://blogs.msdn.com/phaniraj/archive/2009/09/08/using-the-php-toolkit-with-ado-net-data-services.aspx&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;-Mike Flasko&lt;/p&gt;  &lt;p&gt;ADO.NET Data Services, Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9892940" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry><entry><title>Using the ADO.NET Data Services Silverlight client in x-domain and out of browser scenarios – I</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/09/03/using-the-ado-net-data-services-silverlight-client-in-x-domain-and-out-of-browser-scenarios-i.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="755256" href="http://blogs.msdn.com/astoriateam/attachment/9891163.ashx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/09/03/using-the-ado-net-data-services-silverlight-client-in-x-domain-and-out-of-browser-scenarios-i.aspx</id><published>2009-09-04T04:09:00Z</published><updated>2009-09-04T04:09:00Z</updated><content type="html">&lt;p&gt;With the release of &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx"&gt;ADO.NET Data Services v1.5 CTP2&lt;/a&gt;, you can now use the Silverlight Astoria client library to access Cross-Domain services     &lt;br /&gt;and applications written with the new client library can go out of browser. &lt;/p&gt;  &lt;p&gt;The new Client Http networking stack introduced in SL3 supports the standard and custom HTTP Verbs(GET/PUT/POST/DELETE/MERGE)    &lt;br /&gt;as well as access to the response status codes required for a full fidelity REST-based client experience in Silverlight.     &lt;br /&gt;Working with the SL networking team, we modified the Astoria client library to use the networking stack     &lt;br /&gt;in cross-domain and out-of-browser scenarios.     &lt;br /&gt;With this change, we are now able to support Cross-Domain calls allowed by &lt;a href="http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx"&gt;ClientAccessPolicy.xml&lt;/a&gt; files     &lt;br /&gt;and applications written with the Silverlight Astoria client library can go Out Of Browser. &lt;/p&gt;  &lt;h5&gt;I have an existing SL app based on the Astoria client library , what do I need to do to enable my application to    &lt;br /&gt;access X-Domain Data Services and go Out Of Browser ?&lt;/h5&gt;  &lt;p&gt;1. Recompile your application with a reference to the new Silverlight client library .    &lt;br /&gt;2. Update the URI of the Data Service to point to the absolute URI of the Data Service in its new location.     &lt;br /&gt;3. Drop a &lt;a href="http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx"&gt;ClientAccessPolicy.xml&lt;/a&gt; file into the root of the Webserver Hosting your Data Service.     &lt;br /&gt;4. Deploy the newly created application to the Webserver.     &lt;br /&gt;5. In your Silverlight application code, find all the places that you call EndExecute/EndSaveChanges/EndExecuteBatch     &lt;br /&gt;and check if the call is being marshaled back to the UI thread , else Silverlight will throw an invalid Cross-Thread Access Exception.     &lt;br /&gt;To fix this, always dispatch the call to EndExecute to the UI thread using Dispatcher.BeginInvoke.     &lt;br /&gt;As an example: &lt;/p&gt;  &lt;pre class="csharpcode"&gt;nwContext.BeginExecute&amp;lt;Customers&amp;gt;(&lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;&amp;quot;Customers&amp;quot;&lt;/span&gt;),
(asResult) =&amp;gt;
{
 Dispatcher.BeginInvoke(
   () =&amp;gt;{
   CustomersGrid.ItemsSource = nwContext.EndExecute&amp;lt;Customers&amp;gt;(asResult).ToList();
   }
   );                     
}, someUserState);&lt;/pre&gt;
&lt;style type="text/css"&gt;













.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Now , let’s walk through a demo application that illustrates how to build a Silverlight application 
  &lt;br /&gt;that accesses an ADO.NET Data Service from a different domain than the Silverlight application and can also run Out-Of-Browser.&lt;/p&gt;

&lt;p&gt;We have a sample Silverlight application that looks like this :&lt;/p&gt;

&lt;p&gt;Now , let’s walk through a demo application that illustrates how to build a Silverlight application 
  &lt;br /&gt;that accesses an ADO.NET Data Service from a different domain than the Silverlight application and can also run Out-Of-Browser.&lt;/p&gt;

&lt;p&gt;We have a sample Silverlight application that looks like this :&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002_2.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002_thumb.gif" width="393" height="160" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1. SilverlightApplicationHost is the Web application hosting your Silverlight XAP , think of this as UI.Foo.Com. 
  &lt;br /&gt;2. DataServiceHost is the web application hosting the ADO.NET Data Service , think of this as API.Foo.Com 

  &lt;br /&gt;3. DataServicesXDomainSLClient is the Silverlight application that runs in UI.Foo.Com and consumes the Data Service from API.Foo.Com.&lt;/p&gt;

&lt;p&gt;Since the DataServiceHost site hosts the Data Service, it also hosts the ClientAccessPolicy.xml file which allows apps from the 
  &lt;br /&gt;domain hosting the Silverlight app to access resources hosted at API.Foo.com&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002%5B8%5D.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[8]" border="0" alt="clip_image002[8]" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002%5B8%5D_thumb.gif" width="367" height="300" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Silverlight application, DataServicesXDomainSLClient, has a Service Reference to the Data Service hosted at DataServiceHost. 
  &lt;br /&gt;It has two buttons which download an Entity Set called “Publications” from the Data Service and looks like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image001_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image001_thumb.jpg" width="588" height="480" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The “Load Publications Via Uri” downloads Entities from the “Publications” entity set and the Click handler looks like this : &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; btnLoadPublications_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
{
&lt;span class="kwrd"&gt;object&lt;/span&gt; userState = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
&lt;span class="rem"&gt;//download the Publications and sort the Publications in descending order of Name&lt;/span&gt;
publicationContext.BeginExecute&amp;lt;Publication&amp;gt;(
  &lt;span class="kwrd"&gt;new&lt;/span&gt; Uri(&lt;span class="str"&gt;&amp;quot;/Publications?$expand=PublishedFrom&amp;amp;$orderby= Name desc&amp;quot;&lt;/span&gt;, UriKind.Relative),
(asResult) =&amp;gt;
  {
  &lt;span class="rem"&gt;//Dispatch the EndExecute call to the UI thread&lt;/span&gt;
  Dispatcher.BeginInvoke(
   () =&amp;gt;
   {
     var IEnumerableOfPublications = publicationContext.EndExecute&amp;lt;Publication&amp;gt;(asResult);
     PublicationsGrid.ItemsSource = IEnumerableOfPublications.ToList();
   }
   );
   }, userState);
}&lt;/pre&gt;

&lt;p&gt;The “Load Publications Via Linq” downloads entities via a Linq Query and the Click Handler looks like this : &lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; btnLoadPublicationsLinq_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
{
 &lt;span class="kwrd"&gt;object&lt;/span&gt; userState = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
 &lt;span class="rem"&gt;//download the Publications and sort the Publications in ascending order of Name&lt;/span&gt;
 var publicationLinqQuery = (from pub &lt;span class="kwrd"&gt;in&lt;/span&gt; &lt;br /&gt;                       publicationContext.CreateQuery&amp;lt;Publication&amp;gt;(&lt;span class="str"&gt;&amp;quot;Publications&amp;quot;&lt;/span&gt;)&lt;br /&gt;                                                .Expand(&lt;span class="str"&gt;&amp;quot;PublishedFrom&amp;quot;&lt;/span&gt;)
                            orderby pub.Name ascending
                            select pub) &lt;span class="kwrd"&gt;as&lt;/span&gt; DataServiceQuery&amp;lt;Publication&amp;gt;;
publicationLinqQuery.BeginExecute(
 (asResult) =&amp;gt;
 {
  &lt;span class="rem"&gt;//Dispatch the EndExecute call to the UI thread&lt;/span&gt;
    Dispatcher.BeginInvoke(
     () =&amp;gt;
     {
      var IEnumerableOfPublications = publicationLinqQuery.EndExecute(asResult);
      PublicationsGrid.ItemsSource =  IEnumerableOfPublications.ToList();
      });
      }, userState);
  }&lt;/pre&gt;
&lt;style type="text/css"&gt;










.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;










.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;










.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Clicking the “Install Me” button installs the app and launches it Out Of Browser. 
  &lt;br /&gt;Here is what the “Install Me” button click handler looks like : 

  &lt;br /&gt;&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// Installs the Silverlight application as an Out Of Browser application&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;void&lt;/span&gt; InstallApplication(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
{
  &lt;span class="rem"&gt;//Install the app&lt;/span&gt;
  App.Current.Install();
  &lt;span class="rem"&gt;//Hide the &amp;quot;Install Me&amp;quot; button&lt;/span&gt;
  btnInstallOOBApp.Visibility = Visibility.Collapsed;
 }&lt;/pre&gt;
&lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type="text/css"&gt;








.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The buttons which do a Linq Query and a URI query still work , without any changes to the code . 
  &lt;br /&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image001%5B8%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image001[8]" border="0" alt="clip_image001[8]" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image001%5B8%5D_thumb.jpg" width="640" height="422" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Debugging Out Of Browser Silverlight Applications&lt;/h4&gt;

&lt;p&gt;To debug your Out Of Browser Silverlight apps , follow these steps.&lt;/p&gt;

&lt;p&gt;1.&amp;#160; Open the properties of the Silverlight application.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002%5B10%5D.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[10]" border="0" alt="clip_image002[10]" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002%5B10%5D_thumb.gif" width="640" height="341" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2. Select the Out Of Browser application which has the name of the project with the Page hosting the SL application. 
  &lt;br /&gt;Which , in this case , is SilverlightApplicationHost.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002%5B12%5D.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[12]" border="0" alt="clip_image002[12]" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image002%5B12%5D_thumb.gif" width="435" height="69" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3. Hit F5 and select yes when this prompt comes up. 
  &lt;br /&gt;This prompt is warning you that you have a Service Reference to a Data Service. 

  &lt;br /&gt;In In-Browser Silverlight apps , running the SL app directly will launch it off of the file system ( i.e c:\Projects\yourProjectPath), 

  &lt;br /&gt;and you wont be able to make calls to data services&amp;#160; as this would constitute a Cross-Scheme request and isn’t allowed.&lt;/p&gt;

&lt;p&gt;While debugging your Out Of Browser Silverlight application, you can ignore this prompt.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image004_2.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/Usi.NETDataServicesSilverlightclientinxd_BB2C/clip_image004_thumb.gif" width="548" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;&lt;/h4&gt;

&lt;h5&gt;Is the SL3 Client HTTP stack used by the ADO.NET Data Services v1.5 CTP2 client library for all requests?&lt;/h5&gt;

&lt;p&gt;No, the SL3 Client Http Stack is only used for Out-Of-Browser and Cross-domain network access. 
  &lt;br /&gt;The XmlHttp based stack is still used for In Browser, Same Domain network access to preserve backward compatibility. 

  &lt;br /&gt;You can customize this by setting a new property on the client library called HttpStack. 

  &lt;br /&gt;HttpStack which has 3 possible values: &lt;/p&gt;

&lt;p&gt;&lt;b&gt;1. &lt;/b&gt;&lt;b&gt;Auto: &lt;/b&gt;Client library decides when to switch networking stacks. 

  &lt;br /&gt;&lt;b&gt;2. &lt;/b&gt;&lt;b&gt;XmlHttp: &lt;/b&gt;The classic networking stack based on XmlHttpRequest 

  &lt;br /&gt;&lt;b&gt;3. &lt;/b&gt;&lt;b&gt;ClientHttp: &lt;/b&gt;The new SL3 Client HTTP&amp;#160; stack &lt;/p&gt;

&lt;p&gt;The Default value is Auto, and you should leave it as it is, unless you need to customize the networking stack we use. 
  &lt;br /&gt;When the HttpStack is set to Auto, the client library automatically switches the networking stack it uses to talk to 

  &lt;br /&gt;the Data Service. &lt;/p&gt;

&lt;h5&gt;Should I set the HttpStack on the DataServiceContext instance so that I get X-Domain and OOB data access?&lt;/h5&gt;
Nope, you can just leave the HttpStack property at Auto and we will figure out which stack to use and when. 

&lt;br /&gt;We use XmlHttp only in a scenario where the Silverlight XAP and the Data Service are hosted in the same domain. 

&lt;br /&gt;For other scenarios we use the ClientHttpStack. The below table is helpful in understanding when we automatically switch stacks. 

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;
  &lt;table style="background-color: #eeeeee" border="0" cellspacing="0" cellpadding="5"&gt;&lt;tbody&gt;
      &lt;tr style="background-color: #99ccff"&gt;
        &lt;td valign="top" width="179"&gt;
          &lt;p&gt;&lt;b&gt;Silverlight App&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="150"&gt;
          &lt;p&gt;&lt;b&gt;Data Service&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="136"&gt;
          &lt;p&gt;&lt;b&gt;&lt;i&gt;Out Of Browser&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="170"&gt;
          &lt;p&gt;&lt;b&gt;Networking stack&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="179"&gt;
          &lt;p&gt;&lt;b&gt;&lt;a href="http://foo.com"&gt;http://foo.com&lt;/a&gt;&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="150"&gt;
          &lt;p&gt;&lt;a href="http://foo.com"&gt;http://foo.com&lt;/a&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="136"&gt;
          &lt;p&gt;&lt;i&gt;False&lt;/i&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="170"&gt;
          &lt;p&gt;XmlHttp&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="179"&gt;
          &lt;p&gt;&lt;b&gt;&lt;a href="http://foo.com"&gt;http://foo.com&lt;/a&gt;&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="150"&gt;
          &lt;p&gt;&lt;a href="http://foo.com"&gt;http://foo.com&lt;/a&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="136"&gt;
          &lt;p&gt;&lt;i&gt;True&lt;/i&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="170"&gt;
          &lt;p&gt;ClientHttp&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="179"&gt;
          &lt;p&gt;&lt;b&gt;&lt;a href="http://UI.foo.com"&gt;http://UI.foo.com&lt;/a&gt;&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="150"&gt;
          &lt;p&gt;&lt;a href="http://API.foo.com"&gt;http://API.foo.com&lt;/a&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="136"&gt;
          &lt;p&gt;&lt;i&gt;False/True&lt;/i&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="170"&gt;
          &lt;p&gt;ClientHttp&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Features VS Networking Stack &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;table style="background-color: #eeeeee" border="0" cellspacing="0" cellpadding="5"&gt;&lt;tbody&gt;
      &lt;tr style="background-color: #99ccff"&gt;
        &lt;td valign="top" width="245"&gt;
          &lt;p&gt;&lt;b&gt;Feature&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="180"&gt;
          &lt;p&gt;&lt;b&gt;XmlHttp&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="213"&gt;
          &lt;p&gt;&lt;b&gt;ClientHttp&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="245"&gt;
          &lt;p&gt;Cross Domain Data Access&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="180"&gt;
          &lt;p&gt;&lt;b&gt;No&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="213"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="245"&gt;
          &lt;p&gt;Out Of Browser Data Access&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="180"&gt;
          &lt;p&gt;&lt;b&gt;No&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="213"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="245"&gt;
          &lt;p&gt;NTLM Based Authentication&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="180"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="213"&gt;
          &lt;p&gt;&lt;b&gt;No&lt;/b&gt;*&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="245"&gt;
          &lt;p&gt;Same Domain Data Access&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="180"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="213"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="245"&gt;
          &lt;p&gt;Cookie Based Authentication&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="180"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="213"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;

      &lt;tr&gt;
        &lt;td valign="top" width="245"&gt;
          &lt;p&gt;Cookie store shared with browser&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="180"&gt;
          &lt;p&gt;&lt;b&gt;Yes&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;

        &lt;td valign="top" width="213"&gt;
          &lt;p&gt;&lt;b&gt;No&lt;/b&gt;*&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;

&lt;p&gt;*We are working over the next few releases of Silverlight to extend the ClientHttp stack such that it supports 
  &lt;br /&gt;all possible scenarios.&lt;/p&gt;

&lt;h4&gt;Authentication Schemes supported&lt;/h4&gt;

&lt;p&gt;With the new networking stack, in X-Domain and OOB scenarios, the client library is now restricted to the same options as any other application that uses the SL3 networking stack. 
  &lt;br /&gt;The main concern is that NTLM based authentication schemes such as &lt;b&gt;&lt;i&gt;Windows Authentication or BASIC Authentication are not supported in X-Domain and Out Of Browser scenarios&lt;/i&gt;&lt;/b&gt;. 

  &lt;br /&gt;The only authentication schemes that are supported are cookie-based authentication schemes such as ASP.NET Forms Authentication. 

  &lt;br /&gt;An example of using the new client library with ASP.NET Forms Authentication will be shown in Part II of this blog post.&lt;/p&gt;

&lt;p&gt;You can download the sample application shown here at the bottom of the post.&lt;/p&gt;

&lt;p&gt;Phani Raj 
  &lt;br /&gt;Engineer, ADO.NET Data Services .&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9891163" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry><entry><title>Introduction to Data Binding in CTP2</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx" /><id>http://blogs.msdn.com/astoriateam/archive/2009/09/01/introduction-to-data-binding-in-ctp2.aspx</id><published>2009-09-02T01:08:09Z</published><updated>2009-09-02T01:08:09Z</updated><content type="html">&lt;p&gt;This blog post is an update to an introduction to the data binding capabilities we first added in Data Services v1.5 CTP1. In CTP2 we have taken the feedback we received from CTP1 and made some updates to the data binding feature. Since this is a CTP release of this feature we eagerly look forward to hearing more of your feedback.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Introduction to Data Binding&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;A new collection type, DataServiceCollection, has been added to the client library which extends ObservableCollection and supports two way binding for client code. It is now possible to auto generate client side types that implement the INotifyPropertyChanged and INotifyCollectionChanged interfaces using the add service reference gesture. &lt;/p&gt;  &lt;p&gt;This means that, when data binding has been enabled, any changes made to contents of a DataServiceCollection or the entities in the collection will be reflected on the client context; any subsequent calls to SaveChanges() on that context will then persist those changes on the service. As well, any changes made to the entities in the context, through a subsequent query to the data service, will automatically be reflected on the items in the DataServiceCollection. &lt;/p&gt;  &lt;p&gt;This also means that the DataServiceCollection, because it implements the standard binding interfaces, can be bound as the DataSource to most WPF and Silverlight controls.&lt;/p&gt;  &lt;p&gt;Here are some examples of different ways to create a DataServiceCollection using the ADO.NET Data Services client library. In all of these examples, the queries are being executed against a service named “nwsvc” that exposes two types: products and suppliers that have a one-to-many relationship.&lt;/p&gt;  &lt;p&gt;Example 1: Creating a DataServiceCollection of all products.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:408fefc6-6282-4d67-862c-07980f761e7b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 300px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Products&lt;/span&gt;&amp;gt; products =&lt;br&gt;      &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;.CreateTracked&amp;lt;&lt;span style="color:#2b91af"&gt;Products&lt;/span&gt;&amp;gt;(&lt;br&gt;                             nwsvc,&lt;br&gt;                             &lt;span style="color:#0000ff"&gt;from&lt;/span&gt; p &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; nwsvc.Products&lt;br&gt;                             &lt;span style="color:#0000ff"&gt;select&lt;/span&gt; p&lt;br&gt;                             ); &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Example 2: Creating a DataServiceCollection of all products and their associated suppliers.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6e81573f-57fa-49dc-a1cb-af7b27287e3d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 300px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Products&lt;/span&gt;&amp;gt; products =&lt;br&gt;      &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;.CreateTracked&amp;lt;&lt;span style="color:#2b91af"&gt;Products&lt;/span&gt;&amp;gt;(&lt;br&gt;                     nwsvc,&lt;br&gt;                     &lt;span style="color:#0000ff"&gt;from&lt;/span&gt; p &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; nwsvc.Products.Expand(&lt;span style="color:#a31515"&gt;"Suppliers"&lt;/span&gt;)&lt;br&gt;                     &lt;span style="color:#0000ff"&gt;select&lt;/span&gt; p&lt;br&gt;                     ); &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;   &lt;br /&gt;Example 3: Creating a new DataServiceCollection of products. This creates a new empty collection of products without issuing a query against the service. New product objects can be created and added to this collection.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cd53a52e-3a8b-4a8c-870b-4ec76f9740e9" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 300px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af"&gt;Products&lt;/span&gt;&amp;gt; products =&lt;br&gt;      &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;.CreateTracked&amp;lt;&lt;span style="color:#2b91af"&gt;Products&lt;/span&gt;&amp;gt;(&lt;br&gt;                     nwsvc); &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/clip_image010_2.jpg"&gt;&lt;/a&gt;&lt;/p&gt; &lt;b&gt;Walkthrough&lt;/b&gt;   &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The following is a walkthrough of using data binding in a WPF application. The walkthrough is a basic introduction to binding in ADO.NET Data Services, if you are already familiar with binding in WPF and Data Services you may want to wait for the next blog post on data binding that will cover more advanced concepts.&lt;/p&gt;  &lt;p&gt;To get started, you'll want to download all of the required software I use in the walkthrough:&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Visual Studio 2008 SP1 (&lt;a href="http://msdn.microsoft.com/en-us/vs2008/products/cc268305.aspx"&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;ADO.NET Data Services v1.5 CTP2 &lt;a&gt;(&lt;/a&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=a71060eb-454e-4475-81a6-e9552b1034fc&amp;amp;displaylang=en"&gt;here&lt;/a&gt;) &lt;font color="#ff0080" size="3"&gt;&lt;/font&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;Step 1&lt;/b&gt;: Create an ADO.NET Data Service v1.5 Service&lt;/p&gt;  &lt;p&gt;Create a new Web Application (named DatabindingDemo):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_1.png" width="548" height="407" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Our first data access related task is to generate the Entity Framework-based data access layer to the Northwind database.&amp;#160; Right click the ASP.NET project and select 'Add New Item', then select 'ADO.NET Entity Data Model'.&amp;#160; Name the new item nw.edmx:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_6.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_2.png" width="546" height="383" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After clicking ‘Add’ on the screen above, a wizard will open to walk you through creating the Entity Data Model for the Northwind database. Use the default settings until you get to the point where you choose the database objects to include in the model. For this demo, choose only the Products and Suppliers tables.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_3.png" width="391" height="396" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Once you reach the ‘Choose Your Database Objects’ screen, select the two tables and click ‘Finish’. This will open the Entity Data Model designer view.&amp;#160; This view allows you to customize the auto-generated conceptual data model. To learn more about the mapping capabilities of the Entity Framework, see the MSDN page &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc700331.aspx"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/clip_image018_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image018" border="0" alt="clip_image018" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/clip_image018_thumb.jpg" width="367" height="322" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Create a v1.5 CTP2-based ADO.NET Data Service over this model. To create the data service, right click the ASP.NET project and select 'Add New Item'.&amp;#160; Add an 'ADO.NET Data Service v1.5 CTP2' item called nw.svc&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_4.png" width="458" height="322" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This will generate a file (nw.svc.cs) which represents the skeleton of a v1.5 data service. All we need to do now is point the data service at the data model to be exposed as a REST-service and we’ll be set. The snippet below shows the 2 or so lines of code you need to write to do this. One thing to note is that a data service is locked down by default, so we need to take explicit steps to open access to it. For this simple application we’ll enable read and write access to the entire model quickly using the call to ‘SetEntitySetAccessRule’ shown below.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c014b308-d222-40af-84be-8e659fc066e6" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; InitializeService(&lt;span style="color:#2b91af"&gt;DataServiceConfiguration&lt;/span&gt; config)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#008000"&gt;// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#008000"&gt;// Examples:&lt;/span&gt;&lt;br&gt;      config.SetEntitySetAccessRule(&lt;span style="color:#a31515"&gt;"*"&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;EntitySetRights&lt;/span&gt;.All);&lt;br&gt;      config.SetServiceOperationAccessRule(&lt;span style="color:#a31515"&gt;"*"&lt;/span&gt;, &lt;span style="color:#2b91af"&gt;ServiceOperationRights&lt;/span&gt;.All);&lt;br&gt; &lt;br&gt;     &lt;span style="color:#008000"&gt;// TODO: set service behavior configuration options&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#008000"&gt;// Examples:&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#008000"&gt;// config.DataServiceBehavior.AcceptCountRequests = true;&lt;/span&gt;&lt;br&gt;     &lt;span style="color:#008000"&gt;// config.DataServiceBehavior.AcceptProjectionRequests = true;&lt;/span&gt;&lt;br&gt;     config.DataServiceBehavior.MaxProtocolVersion = System.Data.Services.Common.&lt;span style="color:#2b91af"&gt;DataServiceProtocolVersion&lt;/span&gt;.V2;&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;The data service is now created. To test this, run the project and navigate to the nw.svc file. You should see a listing as shown below that outlines all the entry points to the data service. If you don’t, &lt;a href="http://blogs.msdn.com/astoriateam/archive/2007/12/10/viewing-data-services-responses-using-atom-serialization-in-internet-explorer.aspx"&gt;tweak your IE settings&lt;/a&gt; and reload.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_5.png" width="337" height="319" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Step 2: &lt;/b&gt;Enable data binding on the client.&lt;/p&gt;  &lt;p&gt;By default, the client side types generated by ADO.NET Data Services v1.5 CTP2 do not implement binding interfaces. To get client side types that do implement the binding interfaces, you have to tell the code generation library that you want client code that has binding enabled. To do this, set an environment variable before starting Visual Studio and then use Add Service Reference (ASR) to generate client proxy code. The environment variables to set are:&lt;/p&gt;  &lt;p&gt;set dscodegen_usedsc=1&lt;/p&gt;  &lt;p&gt;set dscodegen_version=2.0&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: The use of this environment variable is further explained by the video embedded in &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx"&gt;this blog post&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note&lt;/b&gt;: It is also possible to generate proxy code that have binding enabled using DataSvcUtil.exe with the /DataServiceCollection and /Version flag.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_14.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_6.png" width="554" height="116" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Step 3&lt;/b&gt;: Create client proxy code with binding enabled.&lt;/p&gt;  &lt;p&gt;After setting the environment variable in step 2, open the solution you created in step 1 and create a new WPF project.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_16.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_7.png" width="534" height="398" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Once you have created a WPF client project, the next step is to generate client side types. To do this, find the DatabindingClient project in the solution explorer, right-click the project and select &lt;i&gt;Add Service Reference... &lt;/i&gt;In the Add Service Reference dialog, click the &lt;i&gt;Discover&lt;/i&gt; button. The Northwind.svc service will show up in the &lt;i&gt;Service&lt;/i&gt; window. Enter NorthwindService as the Namespace value and select OK. This wizard will generate a set of client side types that can be used to interact with the service created in step 1.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_18.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_8.png" width="402" height="375" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You will now see a new NorthwindService node under the Service References Node in the solution explorer. As well, you will see a reference to Microsoft.Data.Services.Client in the references node; if you do not see the reference to Microsoft.Data.Services.Client or you see a reference to System.Data.Services.Client go to the ADO.NET Data Services blog and read &lt;a href="http://blogs.msdn.com/astoriateam/archive/2009/03/16/ado-net-data-services-v1-5-ctp1-now-available-for-download.aspx"&gt;this&lt;/a&gt; post about enabling ADO.NET Data Services v1.5 features in Visual Studio and then repeat the Add Service Reference Step.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_20.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_9.png" width="228" height="404" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The next part of this step is to create a new instance of the ADO.NET Data Services client context and connect to the service created in step 1. To do this, add the following code to the Window1.xaml.cs file to create a connection to the service; making sure to replace the host and port number with the values for your service.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:30d7c793-58b5-4188-9f0e-ac69a8d987cf" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 300px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Window1&lt;/span&gt; : &lt;span style="color:#2b91af"&gt;Window&lt;/span&gt;&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#2b91af"&gt;NorthwindEntities&lt;/span&gt; nwsvc = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;NorthwindEntities&lt;/span&gt;(&lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Uri&lt;/span&gt;(&lt;span style="color:#a31515"&gt;"http://localhost:52002/Northwind.svc/"&lt;/span&gt;));&lt;br&gt;  &lt;br&gt;     &lt;br&gt;     &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; Window1()&lt;br&gt;     {&lt;br&gt;         InitializeComponent();&lt;br&gt; &lt;br&gt;     }&lt;br&gt; }&lt;br&gt; &lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The next step is to create an interface that you can bind the result of a query to. The service you created in step 1 exposes a set of Suppliers and a set of Products from the Northwind database with a one-to-many relationship between them. The XAML code below will create two listviews, one to display the suppliers and another to display the products associated with the current supplier selected in the first view. This type of binding is called master-detail binding. &lt;/p&gt;  &lt;p&gt;The code below uses standard WPF binding semantics. The ItemsSource of the supplierView is set to “{Binding}”, this will cause the listview to bind to the collection of items that are supplied as the data context of the supplierView; in this case the collection of items will be a collection of supplier objects. The columns of the supplierView are each bound to a property of the supplier object through the DisplayMemberBinding=&amp;quot;{Binding Path=SupplierID}&amp;quot;/&amp;gt; tag. &lt;/p&gt;  &lt;p&gt;The second listview, productsView, is bound to the Products property of the supplier objects by the ItemsSource=&amp;quot;{Binding Products}&amp;quot; tag. &lt;/p&gt;  &lt;p&gt;By supplying the IsSynchronizedWithCurrentItem=&amp;quot;True&amp;quot; tag on the listview, you are taking advantage of the feature WPF has to automatically display the items in the second list view (products) that are associated with the currently selected item in the first list view (suppliers).&lt;/p&gt;  &lt;p&gt;Paste the following code snippet into the window1.xaml file:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a924faee-e84d-48bc-941a-2ae49413268b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 500px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="productViewGrid"&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView&lt;/span&gt;&lt;span style="color:#ff0000"&gt; ItemsSource&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="25,11,33,145"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="supplierView"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; IsSynchronizedWithCurrentItem&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="True"&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridView&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="ID"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=SupplierID}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Name"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=CompanyName}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Address"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=Address}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="City"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=City}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Region"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Path&lt;/span&gt;&lt;span style="color:#0000ff"&gt;=Region}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridView&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="25,0,33,12"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="productsView"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; ItemsSource&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Products&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; IsSynchronizedWithCurrentItem&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="True"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="117"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Bottom" &amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridView&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="ID"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; ProductID&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Name"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; ProductName&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="QuantityPerUnit"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; QuantityPerUnit&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Price"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; UnitPrice&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;                &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridViewColumn&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="InStock"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; DisplayMemberBinding&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; UnitsInStock&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"/&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;            &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;GridView&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView.View&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;ListView&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;br /&gt;Edit the following attributes of your window: Height=&amp;quot;382&amp;quot; Width=&amp;quot;584&amp;quot; to properly display the controls.   &lt;p&gt;&lt;/p&gt;  &lt;p&gt;This will create a WPF interface that looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_22.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb.png" width="402" height="264" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The final step to enable binding to these WPF controls is to set the DataContext of the grid in the window you just created to the result of a query for suppliers from the service created in step 1. This is done by executing a standard ADO.NET Data Services query on the context for the set of suppliers and then loading the result of the query into a DataServiceCollection. To do this, add the following code to the constructor for the window:&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:92e73ada-863f-4aa3-8f31-0858cc16e076" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 300px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; Window1()&lt;br&gt; {&lt;br&gt;     InitializeComponent();&lt;br&gt;     &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.productViewGrid.DataContext =&lt;br&gt;         &lt;span style="color:#2b91af"&gt;DataServiceCollection&lt;/span&gt;.CreateTracked&amp;lt;&lt;span style="color:#2b91af"&gt;Suppliers&lt;/span&gt;&amp;gt;(nwsvc,&lt;br&gt;                    nwsvc.Suppliers.Expand(&lt;span style="color:#a31515"&gt;"Products"&lt;/span&gt;)&lt;br&gt;                 );&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Once this is complete, compile the project and run it. The result should be:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_24.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_10.png" width="492" height="323" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Step 4: Two-way Binding&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Up to this point in the walkthrough, you have set up a service, created a WPF client and bound the result of a query to the service to a pair of listview controls in the client. This type of binding you have done so far has all been one-way binding. The DataServiceCollection you used at the end of step 3 also supports two-way binding. This means that any changes made to the collection or items in the collection will propagate to the service when a call to SaveChanges() is made on the context. &lt;/p&gt;  &lt;p&gt;This final step will walk you through adding buttons that will add items to the collection of products and take advantage of two-way binding to have those changes propagate to the service and the backing northwind database.&lt;/p&gt;  &lt;p&gt;To start, add the following XAML code to the window1.xaml file to create buttons to that will add a product from the list of products and save the changes to the service.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b5494354-b152-4ce1-bd7a-7d9e77e1ef69" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: auto; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="24"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Right"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="0,0,89,4"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="addButton"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Bottom"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="28"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Click&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="addButton_Click"&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;+&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="24"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Right"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="0,0,33,4"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="saveButton"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Bottom"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="50"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Click&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="saveButton_Click"&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Save&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;The next step is to handle the click events on the new buttons and add the currently select product in the list. The first thing we will need is a new product window to input the property values of a new product when one is created. To do this, create a new WPF window in your client project called ProductWindow.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_26.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/astoriateam/WindowsLiveWriter/IntroductiontoDataBindinginCTP2_101A4/image_thumb_11.png" width="445" height="311" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After creating the window, we need to set up the product window to bind to a single instance of the product class. To configure binding in the product window, you will use the same WPF binding method you used for the supplier window, except this window will bind to a single object and not a collection of objects. Add the following XAML code into the ProductWindow.xaml:&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c61b6cd6-1671-4141-b5d5-d0b8822fd5e0" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 500px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid&lt;/span&gt;&lt;span style="color:#ff0000"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="productGrid"&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="171*" /&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;        &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="159*" /&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="26"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="12,17,68,0"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="nameLabel"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Top"&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Name:&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="12,49,6,0"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="quantityLabel"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="26"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Top"&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Quantity Per Unit:&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="12,78,68,64"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="priceLabel"&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Price:&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="26"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="12,0,68,35"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="inStockLabel"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Bottom"&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;InStock:&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Label&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;TextBox&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="23"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="0,23,28.018,0"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="nameTextBox"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Top"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Text&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; ProductName&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Grid.Column&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="1" /&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;TextBox&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="0,52,28.018,0"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="quantityTextBox"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Text&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; QuantityPerUnit&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="23"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Top"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Grid.Column&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="1" /&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;TextBox&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="0,81,28.018,64"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="priceTextBox"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Text&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; UnitPrice&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Grid.Column&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="1" /&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;TextBox&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="23"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="0,0,28.018,35"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="inStockTextBox"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Bottom"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Text&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="{&lt;/span&gt;&lt;span style="color:#a31515"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000"&gt; UnitsInStock&lt;/span&gt;&lt;span style="color:#0000ff"&gt;}"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Grid.Column&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="1" /&amp;gt;&lt;br&gt; &lt;/span&gt;&lt;span style="color:#a31515"&gt;    &lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Height&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="23"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="19.018,0,61,6"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="okButton"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="Bottom"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Grid.Column&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="1"&lt;/span&gt;&lt;span style="color:#ff0000"&gt; Click&lt;/span&gt;&lt;span style="color:#0000ff"&gt;="okButton_Click"&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515"&gt;OK&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;br&gt; &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515"&gt;Grid&lt;/span&gt;&lt;span style="color:#0000ff"&gt;&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Set the height of the product window to 206 and the width to 296. Next add the following code to the ProductWindow.xaml.cs file to set the data context to a single product and handle the ok button click event. The click event will add the newly created product to the current suppliers list of products.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; width: 579px; padding-right: 5px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:13fc8a68-b652-4550-9175-2b4265880876" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 500px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af"&gt;ProductWindow&lt;/span&gt; : &lt;span style="color:#2b91af"&gt;Window&lt;/span&gt;&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#2b91af"&gt;Suppliers&lt;/span&gt; curSupplier;&lt;br&gt;     &lt;span style="color:#2b91af"&gt;Products&lt;/span&gt; newProduct;&lt;br&gt;     &lt;span style="color:#0000ff"&gt;public&lt;/span&gt; ProductWindow(&lt;span style="color:#2b91af"&gt;Products&lt;/span&gt; p, &lt;span style="color:#2b91af"&gt;Suppliers&lt;/span&gt; s)&lt;br&gt;     {&lt;br&gt;         InitializeComponent();&lt;br&gt;         &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.productGrid.DataContext = p;&lt;br&gt;         curSupplier = s;&lt;br&gt;         newProduct = p;&lt;br&gt;     }&lt;br&gt; &lt;br&gt;     &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; okButton_Click(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;RoutedEventArgs&lt;/span&gt; e)&lt;br&gt;     {&lt;br&gt;         curSupplier.Products.Add(newProduct);&lt;br&gt;         &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.Close();&lt;br&gt;     }&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;The final step is to handle the add and save button click events in the supplier window. Add the following code to the Window1.xaml.cs file.&lt;/p&gt;  &lt;p&gt;Add the following code to the addButton_Click event to create a new product when the add button is selected. The code creates a new Product and creates a new product window for the user to input the property values for the new &lt;a&gt;product&lt;/a&gt; . &lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:49ac0495-ae8d-4880-8bb3-afdd4510d67a" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 300px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; addButton_Click(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;RoutedEventArgs&lt;/span&gt; e)&lt;br&gt; {&lt;br&gt;     &lt;span style="color:#2b91af"&gt;Suppliers&lt;/span&gt; supplier = &lt;span style="color:#0000ff"&gt;this&lt;/span&gt;.supplierView.SelectedItem &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Suppliers&lt;/span&gt;;&lt;br&gt;     &lt;span style="color:#2b91af"&gt;Products&lt;/span&gt; product = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;Products&lt;/span&gt;();&lt;br&gt;     &lt;span style="color:#2b91af"&gt;ProductWindow&lt;/span&gt; win = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;ProductWindow&lt;/span&gt;(product, supplier);&lt;br&gt;     win.Show();&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Add the following code to handle the save button click. This button calls SaveChanges on the context which will cause any operations that have been performed on the context to be sent to the service.&lt;/p&gt;  &lt;div style="padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e8046db8-0cdd-4f50-8220-7d3e4113b6b7" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background-color: #ffffff; max-height: 300px; overflow: scroll; padding: 2px 5px; white-space: nowrap"&gt;
&lt;p&gt;  &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; saveButton_Click(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;RoutedEventArgs&lt;/span&gt; e)&lt;br&gt; {&lt;br&gt;     nwsvc.SaveChanges();&lt;br&gt; }&lt;br&gt;  &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;  &lt;p&gt;Your project is now complete. You can run the form and use the buttons to add items from the collection of products. When you make a change you then click the save button to persist the changes to the service.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Providing Feedback&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;We have created a new forum dedicated to providing feedback on &amp;quot;pre-release&amp;quot; versions of data services such as this CTP.&amp;#160; Please direct all your questions and comments about this feature this new forum which is available at: (&lt;a href="http://social.msdn.microsoft.com/Forums/en-US/dataservices/threads"&gt;http://social.msdn.microsoft.com/Forums/en-US/dataservices/threads&lt;/a&gt;).&amp;#160; &lt;/p&gt;  &lt;p&gt;Note: The forum intended for questions on currently shipping versions of ADO.NET Data Services is still available at: &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/threads/"&gt;(http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/threads/&lt;/a&gt; )&lt;/p&gt;  &lt;p&gt;We look forward to hearing your feedback.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Shayne Burgess&lt;/p&gt;  &lt;p&gt;ADO.NET Data Services, Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9890097" width="1" height="1"&gt;</content><author><name>dpblogs</name><uri>http://blogs.msdn.com/members/dpblogs.aspx</uri></author></entry></feed>