<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://mobileworld.appamundi.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Andy Wigley</title><subtitle type="html" /><id>http://mobileworld.appamundi.com/blogs/andywigley/atom.aspx</id><link rel="alternate" type="text/html" href="http://mobileworld.appamundi.com/blogs/andywigley/default.aspx" /><link rel="self" type="application/atom+xml" href="http://mobileworld.appamundi.com/blogs/andywigley/atom.aspx" /><generator uri="http://communityserver.org" version="4.1.30912.2823">Community Server</generator><updated>2008-11-11T04:54:00Z</updated><entry><title>Windows Phone 7 Series Announced</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2010/02/16/windows-phone-7-series-announced.aspx" /><id>/blogs/andywigley/archive/2010/02/16/windows-phone-7-series-announced.aspx</id><published>2010-02-16T09:27:00Z</published><updated>2010-02-16T09:27:00Z</updated><content type="html">&lt;p&gt;Yesterday, at Mobile World Congress in Barcelona, Microsoft announced their new mobile phone strategy and platform.&lt;/p&gt;
&lt;p&gt;&lt;img height="1027" width="393" src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.UserFiles/00.00.00.21.04/startscreen_5F00_web.jpg" alt="" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As Peter Foot has already reported in his blog (&lt;a href="http://mobileworld.appamundi.com/blogs/peterfoot/archive/2010/02/15/developing-for-windows-phone-7.aspx"&gt;http://mobileworld.appamundi.com/blogs/peterfoot/archive/2010/02/15/developing-for-windows-phone-7.aspx&lt;/a&gt;), the dev story will not be revealed until MIX 2010, which is next month: &lt;a href="http://windowsteamblog.com/blogs/wmdev/archive/2010/02/15/windows-phone-7-series-going-big-for-developers-at-mix10.aspx"&gt;http://windowsteamblog.com/blogs/wmdev/archive/2010/02/15/windows-phone-7-series-going-big-for-developers-at-mix10.aspx&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;
&lt;p&gt;What we can see from the news conference and other postings on the web such as &lt;a href="http://www.microsoft.com/presspass/presskits/windowsphone/videoGallery.aspx"&gt;&lt;span&gt;http://www.microsoft.com/presspass/presskits/windowsphone/videoGallery.aspx&lt;/span&gt;&lt;/a&gt;&amp;nbsp;is that Microsoft has really made a clean break from the earlier generations of Windows Mobile phones. The OS is called &amp;#39;Windows Phone&amp;nbsp;OS 7&amp;#39; but no details have been released yet on how closely it resembles its predecessors and what it will be like as a platform for app development.&lt;/p&gt;
&lt;p&gt;How&amp;nbsp;all this will affect developers is yet to be explained, but clearly life is going to be exciting for those of us working in this space!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://live.visitmix.com/News/Exclusive-Windows-Phone-7-Series-Offer-for-MIX10-Attendees-WP7"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style="clear:both;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;
&lt;hr /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=119" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author></entry><entry><title>Windows Mobile 6.5 Developer Toolkit now available!</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/06/04/windows-mobile-6-5-developer-toolkit-now-available.aspx" /><id>/blogs/andywigley/archive/2009/06/04/windows-mobile-6-5-developer-toolkit-now-available.aspx</id><published>2009-06-04T11:49:00Z</published><updated>2009-06-04T11:49:00Z</updated><content type="html">&lt;p class="MsoNormal"&gt;&lt;span style="font-family:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;The Windows Mobile 6.5 Developer Toolkit is now available!&lt;/span&gt;&lt;span style="mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;a target="_blank" href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=20686a1d-97a8-4f80-bc6a-ae010e085a6e"&gt;&lt;span style="font-family:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;"&gt;http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=20686a1d-97a8-4f80-bc6a-ae010e085a6e&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;There are downloads for WM6.5 Professional and Standard - the Professional version includes the new Gesture APIs and samples!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:10pt;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;See also, Jorge Peraza&amp;#39;s recent blog post: &lt;a href="http://blogs.msdn.com/windowsmobile/archive/2009/06/04/getting-started-with-widgets-on-windows-mobile-6-5.aspx"&gt;Getting started with widgets on Windows Mobile 6.5&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=60" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="Windows Mobile 6.5" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Windows+Mobile+6.5/default.aspx" /></entry><entry><title>TechEd Online: Can Windows Mobile UIs Look as Good as the iPhone?</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/05/22/teched-online-can-windows-mobile-uis-look-as-good-as-the-iphone.aspx" /><id>/blogs/andywigley/archive/2009/05/22/teched-online-can-windows-mobile-uis-look-as-good-as-the-iphone.aspx</id><published>2009-05-22T11:39:00Z</published><updated>2009-05-22T11:39:00Z</updated><content type="html">&lt;p&gt;Love it or loathe it, nobody can deny that the Apple iPhone set a new bar for what constitutes a good mobile UI. In the Windows Mobile development community, many of us have been exploring ways of enhancing the UI of the apps we build to give a rich, compelling experience and there is plenty of good guidance and samples available at sites like the new Windows Mobile developer site: &lt;a href="http://developer.windowsmobile.com"&gt;http://developer.windowsmobile.com&lt;/a&gt; and at established collaboration sites such as &lt;a href="http://www.codeproject.com"&gt;http://www.codeproject.com&lt;/a&gt;. There are also good controls available from companies such as Resco (&lt;a href="http://www.resco.com"&gt;www.resco.com&lt;/a&gt;) .&lt;/p&gt;
&lt;p&gt;Andrej and I enjoyed a 15 minute chat about these topics to camera at Tech Ed in Los Angeles. Watch the video here at &lt;span style="mso-ansi-language:EN-US;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Tech&amp;middot;Ed Online: &lt;b&gt;&lt;a href="http://www.msteched.com/online/view.aspx?tid=a6641301-add9-4a03-b767-53197c3baf74"&gt;&lt;span style="color:#0000ff;"&gt;Can Windows Mobile UIs Look as Good as the iPhone? Yes, They Can!&lt;span style="font-weight:normal;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=59" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /></entry><entry><title>TechEd Online: Extend Dynamics AX and NAV to Devices with Microsoft Dynamics Mobile</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/05/22/teched-online-extend-dynamics-ax-and-nav-to-devices-with-microsoft-dynamics-mobile.aspx" /><id>/blogs/andywigley/archive/2009/05/22/teched-online-extend-dynamics-ax-and-nav-to-devices-with-microsoft-dynamics-mobile.aspx</id><published>2009-05-22T11:35:00Z</published><updated>2009-05-22T11:35:00Z</updated><content type="html">&lt;p&gt;If you are a Microsoft Partner selling Dynamics AX and NAV solutions, you should know about Microsoft Dynamics Mobile. This allows you to extend the system to incorporate mobile devices.&lt;/p&gt;
&lt;p&gt;One of Appamundi&amp;#39;s specialities is in delivering training and development, design and consultancy services to other Microsoft Partners for Microsoft Dynamics Mobile. At Tech Ed Los Angeles, Andrej Radinger and I chatted for 15 minutes or so about this. You can watch the video at &lt;span style="mso-ansi-language:EN-US;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;Tech&amp;middot;Ed Online: &lt;b&gt;&lt;a href="http://www.msteched.com/online/view.aspx?tid=e36def78-1e34-404b-8454-5750cd4ca9e1"&gt;&lt;span style="color:#0000ff;"&gt;Extend Dynamics AX and NAV to Devices with Microsoft Dynamics Mobile&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;.&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=58" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /><category term="Dynamics Mobile" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Dynamics+Mobile/default.aspx" /></entry><entry><title>TechEd Online: patterns &amp; practices Mobile Application Blocks v.Next</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/05/22/teched-online-patterns-amp-practices-mobile-application-blocks-v-next.aspx" /><id>/blogs/andywigley/archive/2009/05/22/teched-online-patterns-amp-practices-mobile-application-blocks-v-next.aspx</id><published>2009-05-22T11:01:00Z</published><updated>2009-05-22T11:01:00Z</updated><content type="html">&lt;p&gt;Anyone remember the Mobile Client Software factory?&lt;/p&gt;
&lt;p&gt;If you have read our Microsoft Press book, &lt;a href="http://www.amazon.com/Microsoft%C2%AE-Mobile-Development-Handbook-Wigley/dp/0735623589/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1242990245&amp;amp;sr=1-1"&gt;Mobile Development Handbook&lt;/a&gt;, you will know that quite a few of the security and web service samples use application blocks from the MCSF. Unfortunately, it&amp;#39;s kinda hard to use the MCSF with Visual Studio 2008, because the installer for the MCSF requires pre-reqs of some Visual Studio add-ins that were only available for Visual Studio 2005 and are hard to find now. &lt;/p&gt;
&lt;p&gt;Thankfully, Microsoft patterns &amp;amp; practices group are doing a refresh! All the best bits from MCSF v1 are being upgraded and updated to Visual Studio 2008, and there are some interesting new additions, especially the ContainerModel block which is a fast, lightweight Inversion of Control container. I&amp;#39;ll be blogging a lot more on these topics over the next few months. You can download the latest drop of these bits at &lt;a href="http://mobile.codeplex.com"&gt;http://mobile.codeplex.com&lt;/a&gt; and there are also a lot of additions done mainly by myself and fellow MVP Nick Randolph which you can find at &lt;a href="http://mobilecontrib.codeplex.com"&gt;http://mobilecontrib.codeplex.com&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;At Tech Ed last week, I spent 20 minutes talking to camera about this new effort and why I am so excited about it. Andrej Radinger asked the questions. See this video at Tech&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Calibri;"&gt;&amp;middot;Ed Online: &lt;b&gt;&lt;a href="http://www.msteched.com/online/view.aspx?tid=59d56f3a-53b1-49d4-8659-855d96c9ad87"&gt;&lt;span style="color:#0000ff;"&gt;patterns &amp;amp; practices Mobile Application Blocks v.Next&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;.&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="mso-ansi-language:EN-US;"&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=57" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /><category term="MCSF" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/MCSF/default.aspx" /><category term="Mobile App Blocks" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Mobile+App+Blocks/default.aspx" /></entry><entry><title>TechEd Online: Windows Mobile Application Development</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/05/22/teched-online-windows-mobile-application-development.aspx" /><id>/blogs/andywigley/archive/2009/05/22/teched-online-windows-mobile-application-development.aspx</id><published>2009-05-22T10:53:00Z</published><updated>2009-05-22T10:53:00Z</updated><content type="html">&lt;p&gt;Last week in Los Angeles, Andrej Radinger and myself took part in a panel discussion with fellow MVPs Ginny Caughey and Alex Feinman, along with Microsoft&amp;#39;s Loke Uei Tan, John Bruno, Jorge Peraza and Steve Bell. Constanze Roman of Microsoft led the discussion.&lt;/p&gt;
&lt;p&gt;Topics included Windows Mobile 6.5, SkyMarket, cool UI and other Windows Mobile-related matters.&lt;/p&gt;
&lt;p&gt;Loke made things interesting by asking the community for questions during the talk using Twitter, so we got live questions thrown at us - interesting!&lt;/p&gt;
&lt;p&gt;Watch the video at &lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-US;mso-fareast-language:EN-GB;mso-bidi-language:AR-SA;"&gt;Tech&amp;middot;Ed Online: &lt;b&gt;&lt;a href="http://www.msteched.com/online/view.aspx?tid=5f438fc9-4865-4f53-825b-30cf4519ce48"&gt;&lt;span style="color:#0000ff;"&gt;Windows Mobile Application Development&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=56" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /></entry><entry><title>Sync Services: Implementing Batching to Reduce Data Transfer Volumes</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/04/27/sync-services-implementing-batching-to-reduce-data-transfer-volumes.aspx" /><id>/blogs/andywigley/archive/2009/04/27/sync-services-implementing-batching-to-reduce-data-transfer-volumes.aspx</id><published>2009-04-27T10:59:00Z</published><updated>2009-04-27T10:59:00Z</updated><content type="html">&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;Synchronization Services supports a limited batching capability which performs multiple transfers of the changed data in smaller batches from server to client, rather than all the changed rows in one go. In order to understand how batching works, you need to understand how SQL Server 2008 change tracking tracks changes, and how Synchronization Services uses that information.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2 style="margin:9pt 0cm 3pt -18pt;padding-left:30px;"&gt;&lt;span&gt;How Synchronization Services Uses Change Tracking Version Numbers&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;When you enable change tracking on a database server, SQL Server 2008 starts to maintain a change version number which increments from zero. Also it maintains a special internal &amp;lsquo;changetable&amp;rsquo; for each table for which you have enabled change tracking. Whenever a row in the table is updated, a record is written to the internal changetable containing the primary key of the changed record and the associated change version number. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:small;"&gt;&lt;span&gt;When a client synchronizes, the server returns to the client the current value of its server-wide change version number, which is available by calling the SQL Server 2008 &lt;/span&gt;&lt;span style="font-family:&amp;#39;Courier New&amp;#39;;"&gt;CHANGE_TRACKING_CURRENT_VERSION&lt;/span&gt;&lt;span&gt; function. You define the T-SQL command to use in your application code by setting the &lt;b style="mso-bidi-font-weight:normal;"&gt;SelectNewAnchorCommand&lt;/b&gt; property of a key object in the server side code of your sync solution, a &lt;b style="mso-bidi-font-weight:normal;"&gt;Microsoft.Synchronization.Data.Server.DbServerSyncProvider&lt;/b&gt; instance. The standard way of defining this, and similar to the code generated by the OCS Designer, is to write code in the DbServerSyncProvider class initialization logic as follows:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;// selectNewAnchorCmd command.&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;SqlCommand selectNewAnchorCommand = new SqlCommand(); &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand = new System.Data.SqlClient.SqlCommand();&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.CommandText = &lt;br /&gt;&amp;quot;Select @sync_new_received_anchor = CHANGE_TRACKING_CURRENT_VERSION()&amp;quot;;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.CommandType = System.Data.CommandType.Text;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;System.Data.SqlClient.SqlParameter selectnewanchorParameter = &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;new System.Data.SqlClient.SqlParameter(&lt;br /&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; &lt;/span&gt;&amp;quot;@sync_new_received_anchor&amp;quot;, &lt;br /&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; &lt;/span&gt;System.Data.SqlDbType.BigInt);&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;selectnewanchorParameter.Direction = &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;System.Data.ParameterDirection.Output;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters.Add(selectnewanchorParameter);&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;// Set to the DbServerSyncProvider&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;this.SelectNewAnchorCommand = selectNewAnchorCommand;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;The client also sends to the server the change tracking version it received from the server the previous time it synchronized (or 0 if this is the first synchronization), so now all the server side code has to do is select all changed rows with a change version greater than the change tracking version the client received at the previous synchronization, and less than or equal to the databases current change version number. This actual logic required is more complex than this, as I have not described how the logic to track inserts, updates and deletions separately is implemented, nor how the ID of the client that made the last update is tracked, but I have simplified this so that it is easier to understand the general process. Refer to SQL Server 2008 documentation for full details. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2 style="margin:9pt 0cm 3pt -18pt;padding-left:30px;"&gt;&lt;span&gt;How to Implement Batching In Synchronization Services &lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;The batch mechanism in Synchronization Services allows you to limit the range of change versions to be sent to the client in each response to a client synchronization request. For example, if the client previously synchronized to version 50, the servers&amp;rsquo; change tracking version is currently 120, and you define a batch size of 30, then the changed rows will be sent in three separate batches: 51-80 in the first transfer, 81-110 in the second and 111-120 in the third.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;One way of enabling this behavior is to define a stored procedure such as the following. This procedure takes five parameters which are required by Synchronization Services:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst"&gt;&lt;span style="font-family:Symbol;mso-bidi-font-family:Symbol;mso-fareast-font-family:Symbol;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&amp;middot;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman;"&gt;&lt;span style="font-size:small;"&gt;&lt;b style="mso-bidi-font-weight:normal;"&gt;@sync_last_received_anchor&lt;/b&gt; which is the change version associated with the clients&amp;rsquo; previous synchronization&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family:Symbol;mso-bidi-font-family:Symbol;mso-fareast-font-family:Symbol;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&amp;middot;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman;"&gt;&lt;span style="font-size:small;"&gt;&lt;b style="mso-bidi-font-weight:normal;"&gt;@sync_batch_size&lt;/b&gt; which is the requested range of change version numbers requested for each batch&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family:Symbol;mso-bidi-font-family:Symbol;mso-fareast-font-family:Symbol;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&amp;middot;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman;"&gt;&lt;span style="font-size:small;"&gt;&lt;b style="mso-bidi-font-weight:normal;"&gt;@sync_max_received_anchor&lt;/b&gt; which is an &amp;lsquo;out&amp;rsquo; parameter which returns the current change version on the server&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="font-family:Symbol;mso-bidi-font-family:Symbol;mso-fareast-font-family:Symbol;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&amp;middot;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman;"&gt;&lt;span style="font-size:small;"&gt;&lt;b style="mso-bidi-font-weight:normal;"&gt;@sync_new_received_anchor&lt;/b&gt; which returns the actual maximum change version number of the set of records selected for the current batch&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast"&gt;&lt;span style="font-family:Symbol;mso-bidi-font-family:Symbol;mso-fareast-font-family:Symbol;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&amp;middot;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-family:Times New Roman;"&gt;&lt;b style="mso-bidi-font-weight:normal;"&gt;@sync_batch_count&lt;/b&gt; which returns the number of batches that are required to complete the synchronization&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;The logic of the stored procedure is described in the comments included in the following script:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:small;"&gt;USE [Northwind]&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;/**** Object:&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;StoredProcedure [dbo].[usp_GetNewBatchAnchor] ****/&lt;br /&gt;CREATE PROCEDURE [dbo].[usp_GetNewBatchAnchor] (&lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_last_received_anchor bigint, &lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_batch_size int,&lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_max_received_anchor bigint out,&lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_new_received_anchor bigint out,&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;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_batch_count int output)&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;br /&gt;AS&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;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- Set a default batch size if a valid one is not passed in.&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;IF&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;@sync_batch_size IS NULL OR @sync_batch_size &amp;lt;= 0&lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SET @sync_batch_size = 1000&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- Before selecting the first batch of changes,&lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- set the maximum anchor value for this synchronization&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- session. After the first time that this procedure is &lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- called, Synchronization Services passes a value for &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;-- @sync_max_received_anchor to the procedure. Batches of &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&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;-- changes are synchronized until this value is reached.&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IF @sync_max_received_anchor IS NULL&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SELECT&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;@sync_max_received_anchor = &lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;change_tracking_current_version()&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- If this is the first synchronization session for a database,&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- get the lowest change version value from the tables. By &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- default, Synchronization Services uses a value of 0 for &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- sync_last_received_anchor on the first synchronization. If&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 style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- you do not set @sync_last_received_anchor,&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- this can cause empty batches to be downloaded until the &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- lowest change version value is reached.&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IF @sync_last_received_anchor IS NULL OR &lt;br /&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;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_last_received_anchor = 0&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;BEGIN&lt;br /&gt;&lt;span style="mso-tab-count:2;"&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;SELECT @sync_last_received_anchor = 0&lt;br /&gt;&lt;br /&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;-- Changes are only retained in the change table for a limited &lt;br /&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;-- period of time set by the CHANGE_RETENTION parameter &lt;br /&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;-- (on ALTER DATABASE).&lt;br /&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;-- Check that we haven&amp;#39;t had changes cleaned up on this table&lt;br /&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;-- (i.e. CHANGE_TRACKING_MIN_VALID_VERSION returns &amp;gt; 0)&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 style="mso-tab-count:2;"&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;IF CHANGE_TRACKING_MIN_VALID_VERSION(&lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;object_id(N&amp;#39;dbo.Customers&amp;#39;)) &amp;gt; &lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_last_received_anchor &lt;br /&gt;&lt;span style="mso-tab-count:2;"&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="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;RAISERROR (N&amp;#39;SQL Server Change Tracking has cleaned up &lt;br /&gt;tracking information for table &amp;#39;&amp;#39;%s&amp;#39;&amp;#39;. To recover from this error, the &lt;br /&gt;client must reinitialize its local database and try &lt;br /&gt;again&amp;#39;,16,3,N&amp;#39;dbo.Customers&amp;#39;)&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-tab-count:2;"&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;SET @sync_new_received_anchor = &lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@sync_last_received_anchor + @sync_batch_size&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-tab-count:2;"&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;-- Determine how many batches are required during the &lt;br /&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;-- initial synchronization.&lt;br /&gt;&lt;span style="mso-tab-count:2;"&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;IF @sync_batch_count &amp;lt;= 0&lt;br /&gt;&lt;span style="mso-tab-count:2;"&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="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;SET @sync_batch_count = (&lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(@sync_max_received_anchor / @sync_batch_size) - &lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(@sync_last_received_anchor /&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;@sync_batch_size)&lt;br /&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;&amp;nbsp;&amp;nbsp; &lt;/span&gt;)&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;END&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ELSE&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;BEGIN&lt;br /&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="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/span&gt;SET @sync_new_received_anchor = &lt;br /&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; &lt;/span&gt;@sync_last_received_anchor + @sync_batch_size&lt;br /&gt;&lt;br /&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="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/span&gt;-- Determine how many batches are required during subsequent &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;-- synchronizations.&lt;br /&gt;&lt;span style="mso-tab-count:2;"&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;IF @sync_batch_count &amp;lt;= 0&lt;br /&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; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;SET @sync_batch_count = (&lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(@sync_max_received_anchor / @sync_batch_size) - &lt;br /&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;(@sync_new_received_anchor /&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;@sync_batch_size)) + 1 &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="mso-tab-count:1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/span&gt;END&lt;br /&gt;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;-- Check whether this is the last batch.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IF @sync_new_received_anchor &amp;gt;= @sync_max_received_anchor&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;BEGIN&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SET @sync_new_received_anchor = @sync_max_received_anchor&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 style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;IF @sync_batch_count &amp;lt;= 0&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SET @sync_batch_count = 1&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;END&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:small;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;In order to activate batch support, create the stored procedure in the database, and then modify the &lt;b style="mso-bidi-font-weight:normal;"&gt;SelectNewAnchorCommand&lt;/b&gt; property of the &lt;b style="mso-bidi-font-weight:normal;"&gt;Microsoft.Synchronization.Data.Server.DbServerSyncProvider&lt;/b&gt; instance to call it, specifying the requested batch size:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;span style="font-size:small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:small;"&gt;SqlCommand selectNewAnchorCommand = new SqlCommand();&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.CommandText = &amp;quot;usp_GetNewBatchAnchor&amp;quot;;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters.Add(&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncLastReceivedAnchor, SqlDbType.BigInt, 8);&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters.Add(&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncMaxReceivedAnchor, SqlDbType.BigInt, 8);&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters.Add(&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncNewReceivedAnchor, SqlDbType.BigInt, 8);&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters.Add(&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncBatchSize, SqlDbType.Int, 4);&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters.Add(&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncBatchCount, SqlDbType.Int, 4);&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters[&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncMaxReceivedAnchor].Direction = &lt;br /&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;ParameterDirection.Output;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters[&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncNewReceivedAnchor].Direction = &lt;br /&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;ParameterDirection.Output;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;selectNewAnchorCommand.Parameters[&amp;quot;@&amp;quot; + &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;SyncSession.SyncBatchCount].Direction = &lt;br /&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;ParameterDirection.InputOutput;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span class="CodeEmbedded"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;span style="color:#000080;"&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:small;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Set to the DbServerSyncProvider&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;this.SelectNewAnchorCommand = selectNewAnchorCommand;&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Set the requested batch size&lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;this.BatchSize = 10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2 style="margin:9pt 0cm 3pt -18pt;padding-left:30px;"&gt;&lt;span&gt;Batching for Client Incremental Changes&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;There is no support in Synchronization Services for sending changes from a client up to the server in smaller batches. You should ensure that your client code synchronizes with the server sufficiently often that the volume of changes cached on the client does not grow to a large number. Large numbers of changes cached on the client could lead to out of memory exceptions when attempting to serialize the DataSet to be sent to the server, and to difficulties in transmitting large amounts of data over slow connections such as cell data networks.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2 style="margin:9pt 0cm 3pt -18pt;padding-left:30px;"&gt;&lt;span&gt;Why Batching May Not Work After Enabling SQL Server 2008 Change Tracking on Populated Tables&lt;/span&gt;&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;There is one particular problem that may occur with batching. If you enable change tracking on a database table before any data is inserted in that table, then as each row is added to the source table, the change will be recorded in the internal changetable and will be assigned a new, unique change version number. In this case, batching will be able to limit the number of rows that are sent to the client on each communication.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;However, if you enable change tracking on a table that already has many rows of data, then the initial state of the table is recorded by adding records to the changetable for all rows with the &lt;i style="mso-bidi-font-style:normal;"&gt;same initial change version number&lt;/i&gt;. As a result, even with batching implemented, when a client synchronizes for the first time, the Synchronization Services server-side code will attempt to return all the rows in the requested table.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span&gt;&lt;span style="font-size:small;"&gt;In this circumstance, you must initialize the client in a different way, perhaps by creating a desktop app to perform the initial sync and then deploy the resulting database to the device.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=51" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author></entry><entry><title>Tech Ed North America, May 11-15, Los Angeles</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/04/21/tech-ed-north-america-may-11-15-los-angeles.aspx" /><id>/blogs/andywigley/archive/2009/04/21/tech-ed-north-america-may-11-15-los-angeles.aspx</id><published>2009-04-21T08:16:00Z</published><updated>2009-04-21T08:16:00Z</updated><content type="html">&lt;p&gt;Andrej Radinger and myself are part of the Windows Mobile team at Tech Ed North America. We will be available to answer questions and talk mobility throughout the conference and much of the time we will be found in the Ask The Experts area on the main exhibit floor.&lt;/p&gt;
&lt;p&gt;We are also delivering a Technical Learning Center session: Windows Mobile 6 SDK Tools during which we will show how to use the many tools found in the SDK. That session is on Wednesday 13th at 10:15am, so please add that to your schedule if you are attending the conference.&lt;/p&gt;
&lt;p&gt;To find out more, or if you still want to register, go to &lt;a href="http://www.msteched.com"&gt;www.msteched.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=48" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /></entry><entry><title>MSDN Webcast: Hiding the Key: Practical Security for Windows Mobile Applications</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2009/04/20/msdn-webcast-hiding-the-key-practical-security-for-windows-mobile-applications.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="1560412" href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.00.47/MSDN-Webcast-Hiding-the-Key-Demos.zip" /><id>/blogs/andywigley/archive/2009/04/20/msdn-webcast-hiding-the-key-practical-security-for-windows-mobile-applications.aspx</id><published>2009-04-20T08:59:00Z</published><updated>2009-04-20T08:59:00Z</updated><content type="html">&lt;p&gt;I am delivering a webcast on 27 April 2009 at 18:00(British Summer Time)/19:00 (Central Europe)/10:00am Pacific Time (US and Canada)/22:30(New Delhi).&lt;/p&gt;
&lt;p&gt;During this webcast I will show some simple demos of how to use synchronbous encryption to encrypt data on a device and explain the importance of securing the encryption key. I will show an example of how to derive an encryption key from a user-entered password as one solution.&lt;/p&gt;
&lt;p&gt;Finally I will show how to use the Password Authentication Block from the Microsoft patterns and practices Mobile App Blocks V2 (the successor to 2005&amp;#39;s Mobile Client Software Factory). The Password Authentication Block provides a great easy to use method of encrypting data such as configuration files and providing a method for distributing encrypted data to hundreds or thousands of clients, and still allow each user to have a unique username and password as the key to decrypting the data. These blocks are currently under development and I am working with the team as a mobile developer community expert advisor; you can find out more and download the blocks at &lt;a href="http://mobile.codeplex.com"&gt;http://mobile.codeplex.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Please register for this webcast, or download the recording after the event, at:&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;b&gt;&lt;span style="font-size:10pt;mso-bidi-font-family:Calibri;"&gt;Attendee Registration URL:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size:10pt;mso-bidi-font-family:Calibri;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;mso-bidi-font-family:Calibri;"&gt;&lt;a href="http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032409117&amp;amp;Culture=en-US"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="font-family:Calibri;"&gt;http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032409117&amp;amp;Culture=en-US&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;mso-bidi-font-family:Calibri;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size:10pt;mso-bidi-font-family:Calibri;"&gt;UPDATE: You can download the demo code from this webcast through the Atachments link at the bottom of this posting.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=47" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /><category term="MSDN" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/MSDN/default.aspx" /><category term="Security" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Security/default.aspx" /></entry><entry><title>Building a Sync Services for ADO.NET Solution for Mobile Devices</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2008/12/08/building-a-sync-services-for-ado-net-solution-for-mobile-devices.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="596272" href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.00.31/SmartDeviceSyncClient.zip" /><id>/blogs/andywigley/archive/2008/12/08/building-a-sync-services-for-ado-net-solution-for-mobile-devices.aspx</id><published>2008-12-08T16:30:00Z</published><updated>2008-12-08T16:30:00Z</updated><content type="html">&lt;p&gt;&lt;strong&gt;*Update*&lt;/strong&gt; :This is the first in a series of posts on Sync Services.&lt;br /&gt;You can read the second post on batching here: &lt;a href="http://mobileworld.appamundi.com/blogs/andywigley/archive/2009/04/27/sync-services-implementing-batching-to-reduce-data-transfer-volumes.aspx"&gt;Sync Services: Implementing batching to reduce data transfer volumes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In my recent webcast &amp;#39;24 Hours of Mobile Development: Networking&amp;#39;, I showed a sample that used Microsoft Synchronization Services for ADO.NET to synchronize a local cache database on a Windows Mobile device with backend SQL Server via a WCF service. I didn&amp;#39;t really go into detail on how to build it, and I&amp;#39;ve had a few enquiries since, so this is how you do it (This is also what I showed at one of my sessions at Tech Ed EMEA in Barcelona in November):&lt;/p&gt;
&lt;h2&gt;Setup your environment&lt;/h2&gt;
&lt;p&gt;First you need to get the right bits for this to work. You need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQL Server 2008/2005 or SQL Server Express 2008/2005&lt;/li&gt;
&lt;li&gt;Visual Studio 2008 SP1&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://www.microsoft.com/downloads/details.aspx?familyid=75FEF59F-1B5E-49BC-A21A-9EF4F34DE6FC&amp;amp;displaylang=en" title="Microsoft Synchronization Services 1.0 SP1 (Devices)"&gt;Microsoft Synchronization Services 1.0 SP1 (Devices)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FCE9ABBF-F807-45D6-A457-AB5615001C8F&amp;amp;displaylang=en" title="Microsoft SQL Server Compact 3.5 Service Pack 1 for Windows Mobile"&gt;Microsoft SQL Server Compact 3.5 Service Pack 1 for Windows Mobile&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that Visual Studio 2008 already includes Sync Services and SQL Server 3.5 SP1 - but only for desktop clients, so you have to install these bits for devices separately.&lt;/p&gt;
&lt;h2&gt;Install the Database&lt;/h2&gt;
&lt;p&gt;Download the sample code for this article (link at the bottom of the page), and use the instnwnd.sql script that is included to create a Northwind database in your database server. Easiest way to do this is to open SQL Server Management Studio, connect to your database server, then use Windows Explorer to navigate to where instnwnd.sql is and double-click it. The script will open in SQL Server Management Studio, then you just have to click the Execute icon in the toolbar and the database will get created. If you are using SQL Server Express, I recommend you first download SQL Server Express Management Studio from MSDN and install it, then use the same technique to execute the database creation script.&lt;/p&gt;
&lt;h2&gt;Create the Solution&lt;/h2&gt;
&lt;p&gt;The key thing here is to create a solution containing two projects - one which is a devices project to contain the client code, and one which is a WCF Service Library or an ASP.NET Web Service which contains the server-side code. In this example, I&amp;#39;ll walk you through creating a solution which uses a WCF Service on the server side.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Start Visual Studio 2008 (use &amp;#39;Run as Administrator&amp;#39; if you&amp;#39;re developing on Vista).&lt;/li&gt;
&lt;li&gt;Create a Smart Device project, call it &amp;#39;SmartDeviceSyncClient&amp;#39; or something else suitable. You can use any Windows Mobile 5 or Windows Mobile 6 target platform and .NET Compact Framework 3.5. Make it a &amp;#39;Device Application&amp;#39; though so it is a Windows Forms application.&lt;/li&gt;
&lt;li&gt;Now add a second project to the same solution. Make this a WCF Service Library project with the name &amp;#39;MiddleTierServiceLibrary&amp;#39; - or your own name.&lt;/li&gt;
&lt;li&gt;When the WCF Service Library has been added, delete IService1.cs and Service1.cs - we are going to use the Sync Services wizards to generate the WCF Service interface and implementation.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Run the Sync Designer&lt;/h3&gt;
&lt;p&gt;This is the bit that confuses most people. Normally, you start the Sync Services Designer by adding a new project item of type &lt;strong&gt;Local Database Cache&lt;/strong&gt; to the client-side project, but this template is not available in device projects. The way you do this is actually to add it to the server-side project, which seems a bit illigical, but works just fine:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In Solution Explorer, right-click the MiddleTierServiceLibrary project, then click &lt;strong&gt;Add&lt;/strong&gt;&amp;nbsp;- &lt;strong&gt;New Item&lt;/strong&gt;. Select &lt;strong&gt;Local Database Cache&lt;/strong&gt; and give it a suitable name, such as &amp;nbsp;NorthwindCache.sync.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Configure Data Synchronization&lt;/strong&gt; wizard, the first thing you must do is use the &lt;strong&gt;Server connection&lt;/strong&gt; dropdown to select an existing database connection to the backend database server where the Northwind database is, or click &lt;strong&gt;New&lt;/strong&gt; to create a new connection.&amp;nbsp;&amp;nbsp;The wizard will automatically generate the client connection for you.&lt;/li&gt;
&lt;li&gt;Next click the &lt;strong&gt;Add&lt;/strong&gt; button underneath the &lt;strong&gt;Cached Tables&lt;/strong&gt; pane. Here is where you select which tables to copy to the client database cache. For this example, just select the Customers table. In the Data to download dropdown, select the default, which is New and incremental changes after first synchronization. This means that Sync Services will only transfer changes between the client and server when synchronizing - the alternative is to transfer the entire table every time.&lt;br /&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/Sync-Configure-Tables.png" alt="" /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;After you click OK, you return to the main Sync Designer wizard screen. Here you must click the Advanced button to reveal additional configuration options. Make sure you select the MiddleTier ServiceLibrary for the Server Project location, and the&amp;nbsp;device project, SmartDeviceSyncClient, as the Client project location.&lt;br /&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/Sync-advanced.png" alt="" /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Now click OK, and the wizard will generate the code for synchronization between the SQL Server Compact 3.5 SP1 database on the client side, and the SQL Server database on the server side. It also does an initial sync and adds a SQOL Server Compact 3.5 SP1 database to your client-side project which already has the Customer table data copied across.&lt;/li&gt;
&lt;li&gt;Next, it displays the &lt;strong&gt;Data Source Configuration Wizard&lt;/strong&gt;. This is prompting you to setup a typed DataSet in your client-side project, because it thinks you&amp;#39;ll need to have something in that project to use in order towork with the data in the client-side database. You can cancel that if you have your own ideas on what you&amp;#39;re going to do with the data once it gets to your client-side application, but for this demo a typed DataSet is fine, so click the &lt;strong&gt;Tables&lt;/strong&gt; checkbox to select all tables (there&amp;#39;s only one of course, the Customers table) and accept the default name of NorthwindDataSet, and then click &lt;strong&gt;Finish&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Setup the WCF Service&lt;/h3&gt;
&lt;p&gt;Think that&amp;#39;s all there is to it? No, not at all! The Sync Designer does a lot of the setup work for you, but you have to do quite a lot more work to get this working.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open up NorthwindCache.SyncContrct.cs - you&amp;#39;ll find it in the server-side project.&lt;/li&gt;
&lt;li&gt;Scroll down to the bottom, and add the XmlSerializerFormat attribute to the INorthwindCacheSyncContract interface definition. This is necessary because the .NET Compact Framework does not support the WCF DataContractSerializer which is the default used by WCF when serializing data for transfer over the network, so adding this attribute ensures that the XmlSerializer is used, which is supported by .NET Compact Framework 3.5.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ServiceContractAttribute()]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt; [XmlSerializerFormat()]&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public interface INorthwindCacheSyncContract {&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; [OperationContract()]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SyncContext ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession);&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; [OperationContract()]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SyncContext GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession);&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; [OperationContract()]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SyncSchema GetSchema(Collection&amp;lt;string&amp;gt; tableNames, SyncSession syncSession);&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; [OperationContract()]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SyncServerInfo GetServerInfo(SyncSession syncSession);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Now scroll up to the top of this file. You will see a large comment block which tells you how to setup the configuration file for the WCF service.&lt;/li&gt;
&lt;li&gt;First, copy the &amp;lt;service&amp;gt;..&amp;lt;/service&amp;gt; definition from the comment block, and paste it into the app.config file, replacing the existing &amp;lt;service&amp;gt;..&amp;lt;/service&amp;gt; configuration. You need to remove the c# comment characters of course, but there are two other changes that are important: 
&lt;ul&gt;
&lt;li&gt;First, change the &lt;strong&gt;binding=&amp;quot;wsHttpBinding&amp;quot;&lt;/strong&gt; to &lt;strong&gt;binding=&amp;quot;basicHttpBinding&amp;quot;&lt;/strong&gt; - .NET Compact Framework doesn&amp;#39;t support &lt;strong&gt;wsHttpBinding&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Second, change the &lt;strong&gt;localhost:8080&lt;/strong&gt; in the baseAddress configuration to the proper host name and port where the service will be running, for example &lt;strong&gt;&amp;#39;myPC:8088&amp;#39;&lt;/strong&gt;, or you can use the raw IP address, for example &lt;strong&gt;&amp;#39;192.168.1.8:8080&amp;#39;&lt;/strong&gt; - the important thing here is to use an address that the device will be able to use to connect to your server; &lt;strong&gt;&amp;#39;localhost&amp;#39;&lt;/strong&gt; is no good because the device will interpret &amp;#39;localhost&amp;#39; as being itself, where of course the WCF service is not running.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now go back to the code file and copy the &amp;lt;behavior&amp;gt;..&amp;lt;/behavior&amp;gt; configuration. Paste this into App.Config replacing the existing definition. No changes are required, other then to uncomment it of course.&lt;br /&gt;The app.config should now look something like this:&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;&lt;br /&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;...&lt;br /&gt;&amp;nbsp; &amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;services&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;service name=&amp;quot;MiddleTierServiceLibrary.NorthwindCacheSyncService&amp;quot; behaviorConfiguration=&amp;quot;MiddleTierServiceLibrary.NorthwindCacheSyncServiceBehavior&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;host&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;baseAddresses&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;add baseAddress =&amp;quot;&lt;a href="http://192.168.1.104:8088/NorthwindCacheSyncService/%22/"&gt;http://&lt;strong&gt;192.168.1.104:8088&lt;/strong&gt;/NorthwindCacheSyncService/&amp;quot;/&lt;/a&gt;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/baseAddresses&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/host&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint address =&amp;quot;&amp;quot; binding=&amp;quot;&lt;strong&gt;basicHttpBinding&lt;/strong&gt;&amp;quot; contract=&amp;quot;MiddleTierServiceLibrary.INorthwindCacheSyncContract&amp;quot;/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endpoint address=&amp;quot;mex&amp;quot; binding=&amp;quot;mexHttpBinding&amp;quot; contract=&amp;quot;IMetadataExchange&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/service&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/services&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behaviors&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceBehaviors&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;behavior name=&amp;quot;MiddleTierServiceLibrary.NorthwindCacheSyncServiceBehavior&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceMetadata httpGetEnabled=&amp;quot;True&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceDebug includeExceptionDetailInFaults=&amp;quot;False&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behavior&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/serviceBehaviors&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/behaviors&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Adding the Service Reference&lt;/h3&gt;
&lt;p&gt;&amp;nbsp;The server-side code is good to go now, so we need to add a service reference to the client-side project.&lt;/p&gt;
&lt;p&gt;There is a trick to doing this successfully with a devices project. If this was a desktop client, we could just right-click on the project and click &amp;#39;Add Service Reference&amp;#39;, but that option is not offered for devices projects. We can use the netcfsvcutil tool that&amp;#39;s in the&amp;nbsp;&lt;a target="_blank" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C8174C14-A27D-4148-BF01-86C2E0953EAB&amp;amp;displaylang=en" title="Power Toys for .NET Compact Framework 3.5"&gt;Power Toys&lt;/a&gt; to generate a client-side proxy, but there&amp;#39;s actually an easier way. Since the WCF basicHttpBinding is actually the same thing as an &amp;#39;old-fashioned&amp;#39; Web Service, we can just Add Web Reference to generate ourselves a client-side proxy for this service. This isn&amp;#39;t quite as easy as it sounds, because first we must get the service running so that the Add Web Reference tool can query it to interrogate the WSDL and generate the proxy.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;To get the service running, right-click on the WCF Service Library project and then click Set as Startup Project. Now click the Debug menu, option Start without Debugging (or CTRL-F5 if you&amp;#39;re using C# developer keymappings in Visual Studio). The solution will build, and then it will put up the Deploy SmartDeviceSyncClient window. Click Cancel here, because we don&amp;#39;t want to deploy the client-side project yet. You&amp;#39;ll then see the There were deployment errors. Continue? pop-up, but here click Yes because we want to continue to run the WCF Service.&lt;/li&gt;
&lt;li&gt;If all is well, you&amp;#39;ll then see the WCF Test Client window displaying - the red exclamation marks against the methods simply indicate that the datatypes they expose are too complex to allow you to use the WCF Test Client to exercise them.&lt;br /&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/WCF-Test-Client.png" alt="" /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Leaving the WCF Test Client running, now go to Solution Explorer, right-click the devices project and then click &lt;strong&gt;Add Web Reference&lt;/strong&gt;. In the Add Web Reference wizard, enter the URL where the WCF Service is running - be careful to append a trailing &amp;#39;/&amp;#39; !! If you leave that off, it won&amp;#39;t find it!&lt;br /&gt;Change the &lt;strong&gt;Web Reference name&lt;/strong&gt; to something meaningful such as &lt;strong&gt;NorthwindProxy&lt;/strong&gt;, then click &lt;strong&gt;Add Reference&lt;/strong&gt;.&lt;br /&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/WCF-Add-Web-Ref.png" alt="" /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;This should generate you the proxy class for the service, and if you compile it, no compile errors will be reported. However, there is still a problem with the proxy that has been generated, and if you try to run this solution (later on when we&amp;#39;ve added a bit more code to the client), then you&amp;#39;ll get runtime errors as you&amp;#39;ll find that certain classes used for Sync Services are multiply defined. That&amp;#39;s because the methods exposed by the WCF Service use a number of classes defined in the Sync Services namespaces, so the Add Web Reference wizard has looked at the WSDL for the service and generated versions of those classes in the proxy - but those classes are also defined in the Sync Services assemblies that are already referenced by the client project.&lt;br /&gt;To fix this, simply edit the proxy code. To find the code, click the &lt;strong&gt;Show All Fles&lt;/strong&gt; icon at the top of Solution Explorer, and expand the &lt;strong&gt;Web References&lt;/strong&gt; node in the client project, and drill down until you see the &lt;strong&gt;Reference.cs/.vb&lt;/strong&gt; file. Open this up in the editor, and delete every class apart from the first, &lt;strong&gt;NorthwindCacheSyncService&lt;/strong&gt;. Finally add &lt;strong&gt;using Microsoft.Synchronization.Data;&lt;/strong&gt; (Imports... of course, for VB) to the top to fix up the now-missing class definitions and we&amp;#39;re good to go. Remember though that if you ever refresh the Web Reference, you&amp;#39;ll have to come in and make this edit again.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Coding the client&lt;/h3&gt;
&lt;p&gt;All that remains is to create a UI, add some code to sync the data and then run it.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;To create the UI, first build the solution. Then, show Form1 in the Designer. Double-click the Form background to create the Form1_Load event handler. Inside this, just add a call to a new method called Sync():&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void Form1_Load(object sender, EventArgs e)&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; Sync();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void Sync()&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;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;Next on the Data menu, click Show Data Sources and drag the Customers table onto the Form (Design view), which will create a DataGrid for you. Set the Dock property to Fill to cover the entire form.&lt;/li&gt;
&lt;li&gt;Now let&amp;#39;s complete the Sync method, where we need to write the code to synchronize the local cache database with the backend database. &lt;br /&gt;The Sync Designer helps here: open the designer again by double-clicking on NorthwindCache.sync in the WCF project, and click the Show Code Example link shown bottom right just above the OK-Cancel buttons. It now displays you the code you need on the client side, and also allows you to copy the code to the clipboard. Do this, and paste the code into the Sync method:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void Sync()&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; // Call SyncAgent.Synchronize() to initiate the synchronization process.&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; // Synchronization only updates the local database, not your project&amp;#39;s data source.&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; NorthwindCacheSyncAgent syncAgent = new NorthwindCacheSyncAgent();&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; Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize();&lt;br /&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; // TODO: Reload your project data source from the local database (for example, call the TableAdapter.Fill method).&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;Now this code is fine for a two-tier solution, but for a 3-tier solution where synchronization takes place via a WCF or Web Service, some additional code is required. First you need to create an instance of your service proxy, then create an instance of Microsoft.Synchronization.Data.ServerSyncProviderProxy, the constructor of which requires the service proxy object, and then you set the RemoteProvider property of the SyncAgent object to that ServerSyncProviderProxy instance before calling Synchronize.&lt;br /&gt;If we add some code to refresh the DataSet object with the data from the database after it has been synchronized, and a MessageBox just to report what has happened during sync, the end result looks like this:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void Sync()&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; Cursor.Current = Cursors.WaitCursor;&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; NorthwindProxy.NorthwindCacheSyncService svcProxy = new NorthwindProxy.NorthwindCacheSyncService();&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; Microsoft.Synchronization.Data.ServerSyncProviderProxy syncProxy =&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; new Microsoft.Synchronization.Data.ServerSyncProviderProxy(svcProxy);&lt;br /&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; // Call SyncAgent.Synchronize() to initiate the synchronization process.&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; // Synchronization only updates the local database, not your project&amp;#39;s data source.&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; NorthwindCacheSyncAgent syncAgent = new NorthwindCacheSyncAgent();&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; syncAgent.RemoteProvider = syncProxy;&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; Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize();&lt;br /&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; // TODO: Reload your project data source from the local database (for example, call the TableAdapter.Fill method).&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; customersTableAdapter.Fill(northwindDataSet.Customers);&lt;br /&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; // Show synchronization statistics&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; MessageBox.Show(&amp;quot;Changes downloaded: &amp;quot; + syncStats.TotalChangesDownloaded.ToString()&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;quot;\r\nChanges Uploaded: &amp;quot; + syncStats.TotalChangesUploaded.ToString());&lt;br /&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; Cursor.Current = Cursors.Default;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;To finish up, click the SmartTag top right of the DataGrid in Design View, then click &lt;strong&gt;Generate Data Forms&lt;/strong&gt; which will generate some UI to allow you to edit records on the client-side. &lt;br /&gt;Make the following code addition to the customersDataGrid_Click method to ensure that changes you make during editing are written back to the underlying database:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void customersDataGrid_Click(object sender, EventArgs e)&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; SmartDeviceSyncClient.CustomersSummaryViewDialog customersSummaryViewDialog = SmartDeviceSyncClient.CustomersSummaryViewDialog.Instance(this.customersBindingSource);&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; customersSummaryViewDialog.ShowDialog();&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;strong&gt;// Update the database with changes made to the dataset&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; customersTableAdapter.Update(northwindDataSet.Customers);&lt;br /&gt;&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;Now&amp;nbsp;create a menu item on the right menu key of Form1 with the text &lt;strong&gt;Sync&lt;/strong&gt;, and in the click event handler just call the Sync() method we created earlier.&lt;/li&gt;
&lt;li&gt;Finally, we have to set the sync up for bidirectional synchronization, as it is configured for download only by default. You program this change in the client project.&lt;br /&gt;In Solution Explorer, find NorthwindCache.Client.sync, right click it and click View Code. Add the following line to the OnInitialized method:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; partial void OnInitialized(){&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;strong&gt;Customers.SyncDirection = Microsoft.Synchronization.Data.SyncDirection.Bidirectional;&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/li&gt;
&lt;li&gt;That&amp;#39;s it! Make sure you set the client project as the Startup project, then debug this on a device that is cradled, or connected by WiFi to the network where your server is located and it will first sync when the Form loads. It will report no changes uploaded or downloaded first time, because the project was setup with a pre-synchronized database. But if you now click on a row in the datagrid, and change the contents of one of the fields in the Edit form, then click the Sync menu, you&amp;#39;ll see that the changes are synced back to the server. Change some data on the server side (an easy way of doing this is to click on the Customers table in Server Explorer in Visual Studio, then click Show Table Data to open up a Grid view of the data on the server side), then sync the client again, and the changes get sent up to the device.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/PPC-Sync.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=31" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /><category term="MSDN" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/MSDN/default.aspx" /><category term="Networking" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Networking/default.aspx" /><category term="Microsoft Synchronization Services for ADO.NET" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Microsoft+Synchronization+Services+for+ADO.NET/default.aspx" /><category term="Sync Services" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Sync+Services/default.aspx" /></entry><entry><title>Connect to devices over USB in Virtual PC using 'USB Over Network'</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2008/11/28/connect-to-devices-over-usb-in-virtual-pc-using-usb-over-network.aspx" /><id>/blogs/andywigley/archive/2008/11/28/connect-to-devices-over-usb-in-virtual-pc-using-usb-over-network.aspx</id><published>2008-11-28T14:39:00Z</published><updated>2008-11-28T14:39:00Z</updated><content type="html">&lt;p&gt;I recently moved all my development work into Virtual PCs - I got fed up with trying to keep my main PC up to date with the latest tools, and more and more I run projects that require different versions of the tools. So now, my main PC just has Office and Virtual PC on it, and not a lot else.&lt;/p&gt;
&lt;p&gt;But it does have 4GB of RAM, which allows me to run two Virtual PCs at the same time which gives me the flexibility I need. Now doing mobile development in Visual Studio running in a virtual PC is fine, as long as you only want to develop using emulators. But sometimes, you really need to work with a real device, and here Microsoft Virtual PC gives us a problem because it does not support connections to USB ports on the host PC. One solution is to use VMWare which does include USB support, but if you want to use Microsoft Virtual PC then an alternative solution is to use a neat product called USB Over Network from FabulaTech which allows you to share access to USB devices over the LAN or even over the Internet. Read about it here: &lt;a href="http://www.fabulatech.com/usb-over-network.html"&gt;http://www.fabulatech.com/usb-over-network.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s really simple to use. Just install the USB over Network Server on your host PC then connect up your device. After your device has connected, open up Network Over USB Server, find the Microsoft Windows Mobile Remote Adapter in the list of USB devices, then click the Share icon on the toolbar.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/USBOverNetworkServer.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;When you share your device, USB Over Network takes over the USB connection to your device, so it is logically no longer connected to your PC.&lt;/p&gt;
&lt;p&gt;Next, go to your Virtual PC and install USB Over Network Client on it. Start it up and enter the name or IP address of the server, after which it displays the shared devices on that server. Select the shared device and then click the &amp;#39;Connect USB Device&amp;#39; toolbar button and that&amp;#39;s it - your mobile device is connected to the virtual PC just as if you had it plugged in directly.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/USBOverNetworkClient.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The price for this solution goes up the more USB devices you want to share concurrently, and at $149 for one device, some may find the price a bit steep purely to get around the lack of USB connectivity in Virtual PC.&amp;nbsp;However, the convenience this gives to device developers who want to develop using Virtual PC&amp;nbsp;is probably worth that investment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=29" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="USB" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/USB/default.aspx" /><category term="Visual Studio" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Visual+Studio/default.aspx" /><category term="Virtual PC" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Virtual+PC/default.aspx" /></entry><entry><title>Accessing RESTful 'Astoria' Data Services in .NET Compact Framework</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2008/11/24/accessing-restful-astoria-data-services-in-net-compact-framework.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="24235" href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.00.28/REST-Sample.zip" /><id>/blogs/andywigley/archive/2008/11/24/accessing-restful-astoria-data-services-in-net-compact-framework.aspx</id><published>2008-11-24T17:17:00Z</published><updated>2008-11-24T17:17:00Z</updated><content type="html">&lt;p&gt;In my recent presentation at Microsoft Tech Ed EMEA 2008 in Barcelona (session MBL304), I talked about how to access RESTful web services from the .NET Compact Framework. I promised that I would post the sample code on my blog, so this post is to fulfil that promise, and also to explain how to do this for those who weren&amp;#39;t in Barcelona. I also used this sample as an example of how to use HttpWebRequest in my recent webcast on Networking, so this post is also relevant to that webcast.&lt;/p&gt;
&lt;h2&gt;What is a RESTful Data Service?&lt;/h2&gt;
&lt;p&gt;REST stands for &amp;#39;&lt;strong&gt;RE&lt;/strong&gt;presentational &lt;strong&gt;S&lt;/strong&gt;tate &lt;strong&gt;T&lt;/strong&gt;ransfer&amp;#39; and is a technique for exposing data over the web in a lightweight manner that is suitable for accessing programmatically using simple HTTP GET, PUT, POST and DELETE verbs. The actual resource that you wish to get/delete/update/create is identified by the uri of the request. For example, if you have a data service that exposes the data of the Northwind database, to get a list of the top-level collections in the data service (maps to the tables or views in the Northwind database), you might issue an HTTP GET to &lt;span style="text-decoration:underline;"&gt;http://myserver/myNorthwindDataService/Northwind.svc&lt;/span&gt; and you&amp;#39;ll get back a bunch of XML. To get a list of all the Customers in Northwind, you issue a GET to &lt;span style="text-decoration:underline;"&gt;http://myserver/myNorthwindDataService/Northwind.svc/Customers&lt;/span&gt; and if you want a specific customer record, you can put the primary key in the URI like this: &lt;span style="text-decoration:underline;"&gt;http://myserver/myNorthwindDataService/Northwind.svc/Customers(&amp;#39;ALFKI&amp;#39;)&lt;/span&gt; which returns all the data for that customer record as XML:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/ADO.NET-Data-Services.jpg" alt="" /&gt;&lt;/p&gt;
&lt;h2&gt;Creating an ADO.NET Data Services website&lt;/h2&gt;
&lt;p&gt;To create a site that exposes the Northwind database in this way, you need Visual Studio 2008 SP1 and the Northwind database installed in SQL Server 2005/2008&amp;nbsp;- I&amp;#39;ve included a script to create the Northwind database in the download accompanying this post. Follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new ASP.NET Website project called &lt;strong&gt;DataServicesWebsite&lt;/strong&gt; - this&amp;nbsp;should be hosted in IIS not the file System to allow devices to access it.&lt;/li&gt;
&lt;li&gt;Delete Default.aspx as we&amp;#39;ll be generating our own service&lt;/li&gt;
&lt;li&gt;In Solution Explorer, right-click on the website root and then click &lt;strong&gt;Add New Item&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;In the Templates window, select &lt;strong&gt;ADO.NET Entity Data Model&lt;/strong&gt;, and in the Name field, enter &lt;strong&gt;NorthwindModel.edmx&lt;/strong&gt;. Click &lt;strong&gt;Add&lt;/strong&gt;. Click &lt;strong&gt;Yes&lt;/strong&gt; to the &amp;#39;You are attempting to add a special file type...&amp;#39; pop-up.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Entity Data Model&lt;/strong&gt; window, select &lt;strong&gt;Generate from database&lt;/strong&gt; and click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;New Connection&lt;/strong&gt; to make a connection to the SQL Server where you have Northwind installed, and when you have that setup click &lt;strong&gt;Next&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Choose Your Database Objects&lt;/strong&gt; window, click the checkbox to select all the Tables, then click &lt;strong&gt;Finish&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You should now see the entity data model diagram - this model will provide the source for our data services website.&lt;/li&gt;
&lt;li&gt;Right-click on the website root in Solution Explorer and then click &lt;strong&gt;Add New Item&lt;/strong&gt;. Select &lt;strong&gt;ADO.NET Data Service&lt;/strong&gt; on the Templates window, and then click &lt;strong&gt;Add&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You will now see a code editor window with the source of a class called &lt;strong&gt;WebDataService&lt;/strong&gt;, which has a couple of TODOs in it. First you&amp;#39;ll see that WebDataService inherits from a generic class: &lt;strong&gt;DataService&amp;lt; /* TODO: put your data source class name here */&amp;gt;&lt;/strong&gt; - replace that TODO with the name of the data source class, which is &lt;strong&gt;NorthwindModel.NorthwindEntities&lt;/strong&gt;. Then inside the &lt;strong&gt;InitializeService&lt;/strong&gt; method, you need to set some access rules, which you can do easily by uncommenting the suggested lines and replacing the first parameter of each with a wildcard character. After this, the class should look like this:&lt;br /&gt;&lt;br /&gt;public class WebDataService : DataService&amp;lt; NorthwindModel.NorthwindEntities &amp;gt;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This method is called only once to initialize service-wide policies.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void InitializeService(IDataServiceConfiguration config)&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; config.SetEntitySetAccessRule(&amp;quot;*&amp;quot;, EntitySetRights.AllRead);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; config.SetServiceOperationAccessRule(&amp;quot;*&amp;quot;, ServiceOperationRights.All);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;That&amp;#39;s it! Now just right-click on &lt;strong&gt;WebDataService.svc&lt;/strong&gt; in Solution Explorer, and click &lt;strong&gt;Set as Start Page&lt;/strong&gt;. Now you can&amp;nbsp;hit &lt;strong&gt;CTRL-F5&lt;/strong&gt; to run&amp;nbsp;the site to check it works - you&amp;#39;ll be able to fetch data from the database just by using a browser window. Try adding &amp;#39;/Customers&amp;#39; or &amp;#39;/Products&amp;#39; to the starting address in the browser window to see how it works.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&amp;nbsp;Creating a .NET Compact Framework Client&lt;/h2&gt;
&lt;p&gt;If you are lucky enough to be a desktop or Silverlight developer, then the ADO.NET Data Services team have created a client-side library for you to use called System.Data.Services.Client, but for some unfathomable reason, they didn&amp;#39;t create this library for .NETCF. That library gives you what is sometimes known as &amp;#39;LINQ to URI&amp;#39;, as it translates LINQ queries into the required HTTP calls to fetch the data. So if you want to know how to use that library from a desktop or Silverlight client, you can look at &lt;a target="_blank" href="http://blogs.microsoft.co.il/blogs/bursteg/archive/2008/05/12/visual-studio-2008-sp1-querying-ado-net-data-service-net-client.aspx" title="this blog"&gt;this blog&lt;/a&gt;&amp;nbsp;from Guy Burstein.&lt;/p&gt;
&lt;p&gt;However, we mobile devs must do it the hard way - which actually is not so hard if we use some simple calls using HttpWebRequest and HttpWebResponse to fetch the XML, and a little bit of LINQ to XML to extract the data we want from the response.&lt;/p&gt;
&lt;p&gt;First, we need to get the XML from the service. We can use a couple of utility methods to do this. Here&amp;#39;s the entire class containing both methods:&lt;/p&gt;
&lt;p&gt;using System;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.IO;&lt;/p&gt;
&lt;p&gt;namespace RESTLibrary&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public enum HttpMethods { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GET = 0, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PUT, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; POST, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DELETE, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HEAD, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPTIONS, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LIST, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UNKNOWN }&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class REST&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; public static HttpWebRequest CreateRequest(string uri, HttpMethods method, string data, string contentType, string userName, string password)&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; WebRequest request = HttpWebRequest.Create(uri);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request.Method = Enum.ToObject(typeof(HttpMethods), method).ToString();&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request.Credentials = &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; new NetworkCredential(userName, password);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; request.ContentType = contentType;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((HttpWebRequest)request).Accept = contentType;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (method != HttpMethods.GET &amp;amp;&amp;amp; method != HttpMethods.DELETE)&lt;br /&gt;&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; Encoding encoding = Encoding.UTF8;&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; request.ContentLength = encoding.GetByteCount(data);&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; request.ContentType = contentType;&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; request.GetRequestStream().Write(&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; encoding.GetBytes(data), 0, (int)request.ContentLength);&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; request.GetRequestStream().Close();&lt;br /&gt;&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; else&lt;br /&gt;&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; // If we&amp;#39;re doing a GET or DELETE don&amp;#39;t bother with this &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; request.ContentLength = 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Finally, return the newly created request to the caller. &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return request as HttpWebRequest;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static string ReadResponse(HttpWebResponse response)&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; // Read the contents to a string &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; // and return that to the caller. &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; string responseBody = String.Empty;&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; using (Stream stm = response.GetResponseStream())&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; using (StreamReader reader = new StreamReader(stm))&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; // Simply read in the entire response to our string. &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; responseBody = reader.ReadToEnd();&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; reader.Close();&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;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return responseBody;&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;/p&gt;
&lt;p&gt;The first of these methods, &lt;strong&gt;CreateRequest&lt;/strong&gt;, creates an HttpWebRequest instance properly configured to make the call to fetch the data. The second utility method, &lt;strong&gt;ReadResponse&lt;/strong&gt;, reads the string that is sent back from the web data service and returns it to the caller. The client code to use these looks like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create the request object using the utility method &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; // This code accesses host ppp_peer so the device must be connected to the server by ActiveSync.&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; HttpWebRequest request = REST.CreateRequest(@&amp;quot;&lt;a href="http://ppp_peer/DataServicesWebsite/NorthwindService.svc/Customers"&gt;http://ppp_peer/DataServicesWebsite/NorthwindService.svc/Customers&lt;/a&gt;&amp;quot;,&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; HttpMethods.GET, String.Empty, @&amp;quot;application/atom+xml&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;); &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Now, attempt to read in the data. &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; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())&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; string responseXml = REST.ReadResponse(response);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do something with the response XML&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;/p&gt;
&lt;p&gt;All that remains is to extract the data we want from the XML. If you haven&amp;#39;t used LINQ to XML much, here is the important stuff you need to know. &lt;/p&gt;
&lt;p&gt;Let&amp;#39;s say we want to extract the CustomerID, CompanyName and City of every customer in the Customers collection. If you use a browser to look at the XML returned for the Customers collection, you&amp;#39;ll see that the elements we want are all children of the properties tag:&lt;/p&gt;
&lt;p&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; standalone=&amp;quot;yes&amp;quot; ?&amp;gt;&lt;br /&gt;- &amp;lt;feed xml:base=&amp;quot;&lt;a href="http://localhost/DataServicesWebsite/NorthwindService.svc/"&gt;http://localhost/DataServicesWebsite/NorthwindService.svc/&lt;/a&gt;&amp;quot; xmlns:d=&amp;quot;&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices&lt;/a&gt;&amp;quot; xmlns:m=&amp;quot;&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/metadata&lt;/a&gt;&amp;quot; xmlns=&amp;quot;&lt;a href="http://www.w3.org/2005/Atom"&gt;http://www.w3.org/2005/Atom&lt;/a&gt;&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;title type=&amp;quot;text&amp;quot;&amp;gt;Customers&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;id&amp;gt;http://localhost/DataServicesWebsite/NorthwindService.svc/Customers&amp;lt;/id&amp;gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;... &lt;br /&gt;- &amp;lt;content type=&amp;quot;application/xml&amp;quot;&amp;gt;&lt;br /&gt;- &lt;strong&gt;&amp;lt;m:properties&amp;gt;&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;&amp;lt;d:CustomerID&amp;gt;ALFKI&amp;lt;/d:CustomerID&amp;gt;&lt;/strong&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;d:CompanyName&amp;gt;Alfreds Futterkiste&amp;lt;/d:CompanyName&amp;gt;&lt;/strong&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ContactName&amp;gt;Maria Anders&amp;lt;/d:ContactName&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:ContactTitle&amp;gt;Sales Representative&amp;lt;/d:ContactTitle&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Address&amp;gt;Obere Str. 57&amp;lt;/d:Address&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;d:City&amp;gt;Berlin&amp;lt;/d:City&amp;gt;&lt;/strong&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;d:Region m:null=&amp;quot;true&amp;quot; /&amp;gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;lt;/m:properties&amp;gt;&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;m:&lt;/strong&gt; prefix to the properties tag, and the &lt;strong&gt;d:&lt;/strong&gt; prefix to the individual fields tags are important - they indicate that the tag belongs in a particular XML namespace. The &amp;#39;d&amp;#39; and &amp;#39;m&amp;#39; are both symbols for namespaces, which are defined at the top of the XML in the &lt;strong&gt;&amp;lt;feed&amp;gt;&lt;/strong&gt; element:&lt;/p&gt;
&lt;p&gt;- &amp;lt;feed xml:base=&amp;quot;&lt;a href="http://localhost/DataServicesWebsite/NorthwindService.svc/"&gt;http://localhost/DataServicesWebsite/NorthwindService.svc/&lt;/a&gt;&amp;quot; xmlns:&lt;strong&gt;d&lt;/strong&gt;=&amp;quot;&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices&lt;/a&gt;&amp;quot; xmlns:&lt;strong&gt;m&lt;/strong&gt;=&amp;quot;&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/metadata&lt;/a&gt;&amp;quot; xmlns=&amp;quot;&lt;a href="http://www.w3.org/2005/Atom"&gt;http://www.w3.org/2005/Atom&lt;/a&gt;&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;Tags that do not have a prefix are in the &lt;em&gt;default&lt;/em&gt; namespace, which is the one specified in the &amp;lt;feed&amp;gt; element that does not have prefix, which is the last one listed, &lt;strong&gt;xmlns=&lt;/strong&gt;&lt;a href="http://www.w3.org/2005/Atom"&gt;&lt;strong&gt;http://www.w3.org/2005/Atom&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once you understand the definition of the namespaces, the LINQ to XML query to select the required customer properties from every record in the Customers collection becomes the following. This example not only selects the target fields, but uses the values to initialise a new instance of a &lt;em&gt;CustLite&lt;/em&gt; object, which is a custom class defined for this example that just has three public properties, &lt;strong&gt;CustomerID&lt;/strong&gt;, &lt;strong&gt;CompanyName&lt;/strong&gt; and &lt;strong&gt;City&lt;/strong&gt;. As a result, the type of the customerIdList, defined as &lt;em&gt;var&lt;/em&gt; in the code, is actually a List&amp;lt;CustLite&amp;gt;:&lt;/p&gt;
&lt;p&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; // After reading in the response parse the response into a XDocument. &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; XDocument customerDoc = XDocument.Parse(responseXml);&lt;/p&gt;
&lt;p&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; XNamespace ads = @&amp;quot;&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices&lt;/a&gt;&amp;quot;;&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; XNamespace m = @&amp;quot;&lt;a href="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"&gt;http://schemas.microsoft.com/ado/2007/08/dataservices/metadata&lt;/a&gt;&amp;quot;;&lt;/p&gt;
&lt;p&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; var customerIdList =&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; from c in customerDoc.Descendants(m + &amp;quot;properties&amp;quot;)&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; select&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 CustLite()&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerID = c.Element(ads + &amp;quot;CustomerID&amp;quot;).Value,&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; CompanyName = c.Element(ads + &amp;quot;CompanyName&amp;quot;).Value,&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; City = c.Element(ads + &amp;quot;City&amp;quot;).Value,&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;/p&gt;
&lt;p&gt;Once we have our List&amp;lt;CustLite&amp;gt; we can use it in our app, for example to display it in a DataGrid:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img src="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/andywigley/CustLite-Display.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can download the code for the sample from the link below. Note that this example shows how to get data formatted using the ATOM MPP XML format, but ADO.NET Data Services also returns data in JSON if you ask it right - that&amp;#39;s the subject for another post...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=28" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /><category term="MSDN" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/MSDN/default.aspx" /><category term="Networking" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Networking/default.aspx" /><category term="Astoria" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Astoria/default.aspx" /><category term="REST" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/REST/default.aspx" /></entry><entry><title>MSDN Webcast: 24 Hours of Windows Mobile Application Development: Windows Mobile Networking (Level 300)</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2008/11/17/msdn-webcast-24-hours-of-windows-mobile-application-development-windows-mobile-networking-level-300.aspx" /><id>/blogs/andywigley/archive/2008/11/17/msdn-webcast-24-hours-of-windows-mobile-application-development-windows-mobile-networking-level-300.aspx</id><published>2008-11-17T10:08:00Z</published><updated>2008-11-17T10:08:00Z</updated><content type="html">&lt;p&gt;I am giving a webcast for &lt;strong&gt;MSDN&lt;/strong&gt; on Wednesday November 19, 2008 at 10:00am Pacific Time/3:00pm EST/6:00pm UK/19:00 Western Europe.&lt;/p&gt;
&lt;p&gt;From the event overview:&lt;br /&gt;&amp;quot;In this webcast, you learn how to create a network connection in code and how to discover if you have network connectivity. We look at the design of applications that need to be network aware and strategies for creating applications that can operate when disconnected from the network and then sync up data when network connectivity is restored. We also compare the options for transferring data over a network connection, which include ActiveSync, Microsoft SQL Server merge replication, remote data access (RDA), SQLClient, Microsoft Synchronization Services for ADO.NET, Windows Communication Foundation (WCF), SOAP-based Web services, RESTful data services, and Microsoft Message Queuing (MSMQ). We explain the benefits and shortcomings of each sync technology and demonstrate many of them so you can select the right solution for your data synchronization needs.In this webcast, you learn how to create a network connection in code and how to discover if you have network connectivity. We look at the design of applications that need to be network aware and strategies for creating applications that can operate when disconnected from the network and then sync up data when network connectivity is restored. We also compare the options for transferring data over a network connection, which include ActiveSync, Microsoft SQL Server merge replication, remote data access (RDA), SQLClient, Microsoft Synchronization Services for ADO.NET, Windows Communication Foundation (WCF), SOAP-based Web services, RESTful data services, and Microsoft Message Queuing (MSMQ). We explain the benefits and shortcomings of each sync technology and demonstrate many of them so you can select the right solution for your data synchronization needs.&amp;quot;&lt;/p&gt;
&lt;p&gt;Please go to &lt;a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032393505&amp;amp;EventCategory=4&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;the MSDN Webcasts event page&lt;/a&gt;&amp;nbsp;to register, or if you missed it, to download the recording.&lt;/p&gt;
&lt;p&gt;Hope you can watch and ask some questions!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=26" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="Webcast" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Webcast/default.aspx" /><category term="MSDN" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/MSDN/default.aspx" /><category term="Networking" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/Networking/default.aspx" /></entry><entry><title>Sample code for WM6 SDK Tools session</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2008/11/11/sample-code-for-wm6-sdk-tools-session.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="518780" href="http://mobileworld.appamundi.com/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.00.00.25/WM6-SDK-Tools-_2D00_-Demonstration-Code" /><id>/blogs/andywigley/archive/2008/11/11/sample-code-for-wm6-sdk-tools-session.aspx</id><published>2008-11-11T10:08:00Z</published><updated>2008-11-11T10:08:00Z</updated><content type="html">&lt;p&gt;Here is the sample code for the session Andrej and I just gave on the Windows Mobile 6 SDK Tools here at Barcelona.&lt;/p&gt;
&lt;p&gt;The sample illustrates SMS interception, Pockket Outlook Object Model programming, WCF programming, camera capture and State and Notification Broker.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=25" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /></entry><entry><title>Tech Ed EMEA 2008</title><link rel="alternate" type="text/html" href="/blogs/andywigley/archive/2008/11/11/tech-ed-emea-2008.aspx" /><id>/blogs/andywigley/archive/2008/11/11/tech-ed-emea-2008.aspx</id><published>2008-11-11T09:54:00Z</published><updated>2008-11-11T09:54:00Z</updated><content type="html">&lt;p&gt;I am in sunny Barcelona, giving five sessions this year.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;MBL01-IS&amp;nbsp; Windows Mobile 6 SDK Tools&lt;/span&gt;&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;November 11 09:00 - 10:15&amp;nbsp; Room 134&amp;nbsp; &lt;br /&gt;Visual Studio 2008 brings lot of improvements for mobile developers, and Windows Mobile 6 SDKs tools that allow developers easier and faster solution development. This interactive session will show you what is new in .NET Compact Framework 3.5, as well as WM 6 SDK Tools. Learn how to emulate GPS, how to configure and use emulators, and how to simulate input stress using Hopper. You will also see how to use Cellular Emulator to emulate presence of mobile operator network to make and receive calls, and transfer data and learn about FakeServer. Session will be packed with live demos and you will have the opportunity to ask what you always wanted to ask and discuss your experiences or problems. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;MBL304&amp;nbsp; Accessing RESTful Web Data Services in the Microsoft .NET Compact Framework: The Lightweight Alternative to SOAP&lt;/span&gt;&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;November 12 10:45 - 12:00&amp;nbsp; Room 125&amp;nbsp; &lt;br /&gt;Most Microsoft developers are used to working with SOAP-based Web services and these RPC-like services have been used successfully in many mobile applications that need to access services hosted on remote servers. However, now there&amp;#39;s a new kid on the block for remote data access that - its proponents claim - is lightweight, flexible, and works in the way the architects of the Web intended, using many of the built-in features of HTTP. REST stands for Representational State Transfer and is gathering supporters throughout the Web for its flexibility and the ease with which you can perform CRUD (Create, Read, Update, Delete) operations on remote data. Indeed, REST is used for exposing data in new Microsoft products such as ADO.NET Data Services and SQL Server Data Services. In this session, we compare the strengths and weaknesses of REST and SOAP, take a look at how to serialize data using JSON, and work through some demos to show how to program .NET Compact Framework applications that use REST to access services built with ADO.NET Data Services and those exposed by Web 2.0 APIs such as Facebook.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;MBL402&amp;nbsp; Building Data Sync Solutions with Microsoft Synchronization Services for ADO.NET&amp;nbsp;&lt;/span&gt;&lt;/strong&gt; &lt;br /&gt;November 13 17:30 - 18:45&amp;nbsp; Room 115&amp;nbsp; &lt;br /&gt;In this session we will take a detailed look at Microsoft Synchronization Services for ADO.NET to explain solutions for the things that make data synchronization solutions tough, such as how to batch updates so that you can successfully sync large volumes of updates over low bandwidth connections, and how to build a custom server sync provider for when your backend database isn&amp;#39;t SQL Server. There will be plenty of demos, as we walk through practical examples of synchronizing data items between a backend Server and &amp;#39;Edge of the Network&amp;#39; computers such as laptops and mobile devices.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;MBL05-IS&amp;nbsp; Sync This Way: Comparing the Sync Solutions&lt;/span&gt;&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;November 14 09:00 - 10:15&amp;nbsp; Room 132&amp;nbsp; &lt;br /&gt;Are you confused by all the data sync options for Windows Mobile applications? Are you having trouble working out which is the best solution for you? In this Interactive Session, we will look at each of the current choices for synchronising data between your device and back-end servers. Come along with your questions about ActiveSync, SQL Server merge replication, RDA (remote data access), SQLClient, Microsoft Synchronization Services for ADO.NET, WCF, SOAP-based Web services, RESTful data services and MSMQ. There will be lots of demos of these technologies so you can see what it takes to configure and program each one. You&amp;#39;ll go away with a good understanding of the benefits and shortcomings of each sync technology, so you&amp;#39;ll be able to select the right solution for your data synchronization needs.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;MBL01-PAN&amp;nbsp; Ask the Windows Mobile Panel&lt;/span&gt;&lt;/strong&gt;&amp;nbsp; &lt;br /&gt;November 14 15:15 - 16:30&amp;nbsp; Room 119 (DEV)&amp;nbsp; &lt;br /&gt;In this panel session, you will have an opportunity to ask the team of Microsoft and community experts any burning questions related to Windows Mobile! Share industry experience, express your opinions and make your wishes known to Microsoft about what you want the future of Windows Mobile to look like. This is a great opportunity to drive dialogue among your peers, Microsoft and our community leads, to clarify technical understanding, provide ideas for moving ahead and just have fun networking with our Windows Mobile gurus. &lt;/p&gt;
&lt;p&gt;I am here with Appamundi colleague, Andrej Radinger. If you are in Barcelona, come to our sessions, and come and talk to us!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://mobileworld.appamundi.com/aggbug.aspx?PostID=24" width="1" height="1"&gt;</content><author><name>Andy Wigley</name><uri>http://mobileworld.appamundi.com/members/Andy-Wigley/default.aspx</uri></author><category term="TechEd" scheme="http://mobileworld.appamundi.com/blogs/andywigley/archive/tags/TechEd/default.aspx" /></entry></feed>