<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Dinesh's Cyberstation</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Moving to a new location www.dineshk.net</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2010/10/28/moving-to-a-new-location-www-dineshk-net.aspx</link><pubDate>Thu, 28 Oct 2010 17:21:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10082239</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=10082239</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2010/10/28/moving-to-a-new-location-www-dineshk-net.aspx#comments</comments><description>&lt;p&gt;After a long break, I plan to restart blogging - but in a more personal location so I can blog about a few more things than would make sense under msdn.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.DineshK.net"&gt;http://www.DineshK.net&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hope to see you there&lt;/p&gt;
&lt;p&gt;Dinesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10082239" width="1" height="1"&gt;</description></item><item><title>.NET RIA Services Resources (for March 2009 Preview)</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2009/03/26/net-ria-services-resource-for-march-2009-preview.aspx</link><pubDate>Fri, 27 Mar 2009 02:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9512357</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=9512357</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2009/03/26/net-ria-services-resource-for-march-2009-preview.aspx#comments</comments><description>&lt;p&gt;Some of it is covered in my previous post and on Silverlight.net but here is a summary:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Bits (prereq: Visual Studio 2008 SP1, &lt;a href="http://silverlight.net/getstarted/silverlight3/default.aspx"&gt;Silverlight 3 beta&lt;/a&gt; tools for VS): &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;amp;displaylang=en"&gt;RIA Services March Preview&lt;/a&gt; (unveiled last week at MIX)&lt;/li&gt; &lt;li&gt;Documentation / video&lt;/li&gt; &lt;ol&gt; &lt;li&gt;A PDF file with an intro and quick starts is &lt;a href="http://go.microsoft.com/fwlink/?LinkID=144687"&gt;here&lt;/a&gt;&lt;/li&gt; &lt;li&gt;If you have an hour or so, you could try the walkthrough in the RIA Services March Preview MSI&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;MIX talks - videos&lt;/li&gt; &lt;ol&gt; &lt;li&gt;RIA Services + Client &lt;a href="http://videos.visitmix.com/MIX09/T40F" target="_blank"&gt;Overview&lt;/a&gt; (BradA)&lt;/li&gt; &lt;li&gt;RIA Services &lt;a href="http://videos.visitmix.com/MIX09/T41F" target="_blank"&gt;Deep Dive&lt;/a&gt; (NikhilKo) &lt;/li&gt;&lt;/ol&gt; &lt;li&gt;Samples: &lt;a href="http://code.msdn.microsoft.com/RiaServices"&gt;http://code.msdn.microsoft.com/RiaServices&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Questions, comments, bug reports, feedback: &lt;a href="http://silverlight.net/forums/53.aspx" target="_blank"&gt;.NET RIA Services Forum&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Common questions and quick answers: &lt;p&gt;How is this related to ADO.NET Data Services (Astoria)? &lt;br&gt;We have a plan to give you the best of both the worlds in forthcoming CTPs. You can see slide #19 in Pablo's talk for an outline. (The March preview does not use Astoria) &lt;p&gt;Do I have to use LINQ to SQL or EF?&lt;br&gt;No you do not. You can just use DomainService base class. In fact when you access web services or XML file or some other non-ORM source, it makes sense to just write your class to derive from DomainService. For other ORMs, we are working with a few community members to get provider stories worked out. We also hope to publish a provider sample to help out. &lt;p&gt;Do I have to use Silverlight?&lt;br&gt;No you don't have to (though I hope you at least try it out). While we have a great story with Silverlight beta, you could also use RIA Services in a web app with a few early preview bits of ASP.NET DomainDataSource. There is also an SEO story. In future, we hope to bring you AJAX, publishing as a web service etc. &lt;p&gt;What is the Silverlight 3.0 RTM story? &lt;br&gt;We are planning to release an updated CTP in the Silverlight 3.0 RTM timeframe to integrate with Silverlight 3.0. We would like to release go-live CTPs later in the year before an RTW (date TBD). &lt;p&gt;Are you feature-complete? Are there more goodies coming?&lt;br&gt;There is more stuff to come. So send you feedback in - on forum or one of the team member blogs. So fire away.  &lt;p&gt;What features are you considering?&lt;br&gt;That is a good topic for future blog/forum posts. I have to think about getting the candidate feature list in a reasonable shape with good description so you can give some feedback. &lt;p&gt;I tried running this on &amp;lt;blah&amp;gt; with &amp;lt;foo&amp;gt; turned on and &amp;lt;bar&amp;gt; off and &amp;lt;baz&amp;gt; showed up? Is this expected?&lt;br&gt;You bet that's by design :-). That aside, this sounds like a great question to ask on the &lt;a href="http://silverlight.net/forums/53.aspx"&gt;forum&lt;/a&gt; where people are trying out all kinds of things way beyond the capability and imagination of the little team that built RIA Services preview (and certainly beyond my very limited knowledge).  &lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9512357" width="1" height="1"&gt;</description></item><item><title>.NET RIA Services is now public</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2009/03/18/net-ria-services-is-now-public.aspx</link><pubDate>Wed, 18 Mar 2009 21:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9487638</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=9487638</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2009/03/18/net-ria-services-is-now-public.aspx#comments</comments><description>&lt;p&gt;A few folks have asked me what I have been up to after wrapping up LINQ previews and V1. I have not been able to answer that question satisfactorily because what we were working on was non-public (well almost except the mention of now obsolete name "Alexandria" at PDC 2008).&lt;/p&gt; &lt;p&gt;Few other folks have wondered aloud if I was deaf to their feedback about the importance of multi-tier support in LINQ to SQL (and similar projects). I was not deaf but I couldn't answer that question satisfactorily either.&lt;/p&gt; &lt;p&gt;Now I can answer both by pointing to a real preview; not just blah blah.&lt;/p&gt; &lt;p&gt;Take a look at the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;amp;displaylang=en"&gt;.NET RIA Services March 2009 preview&lt;/a&gt;. It is intended to:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Simplify n-tier development (and really show you a better way to get multi-tier story for your ORM objects - LINQ to SQL or EF or whatever)  &lt;li&gt;Support Rich Internet Application (RIA) development on Silverlight - there is great end-to-end story for validation, authentication, easy databinding etc.  &lt;li&gt;Extend your ASP.NET development experience. This is based on what you know and use already. There is even an ASP.NET DomainDataSource and templates for SEO there (and hopefully some AJAX stuff soon - fingers crossed).&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Personally another satisfying thing is that, now I can answer your questions in a straightforward fashion without worrying about what I am allowed to say.&lt;/p&gt; &lt;p&gt;BTW, in the good tradition of the LINQ project, we also have a great walkthrough in the MSI and a good set of &lt;a href="http://download.microsoft.com/download/F/B/8/FB8CA635-296B-487F-965C-8148F08B5319/riaservicesoverviewpreview.pdf" mce_href="http://download.microsoft.com/download/F/B/8/FB8CA635-296B-487F-965C-8148F08B5319/riaservicesoverviewpreview.pdf"&gt;quick starts&lt;/a&gt; on the download page.&lt;/p&gt; &lt;p&gt;Don't forget to see &lt;a href="http://blogs.msdn.com/brada/" mce_href="http://blogs.msdn.com/brada/"&gt;Brad&lt;/a&gt;'s and &lt;a href="http://www.nikhilk.net/" mce_href="http://www.nikhilk.net/"&gt;Nikhil&lt;/a&gt;'s sessions at &lt;a href="http://live.visitmix.com/" mce_href="http://live.visitmix.com/"&gt;MIX&lt;/a&gt; - either live or after the fact.&lt;/p&gt; &lt;p&gt;Dinesh&lt;/p&gt; &lt;p&gt;P.S. (Thu 3/19 update): We also have some &lt;a href="http://code.msdn.microsoft.com/RiaServices"&gt;cool additional code&lt;/a&gt; for you. There is a new project template that missed the March 09 preview train by a hair - it makes authentication hookup really simple. Two sample apps make it easier for you to build good looking apps with real data hookup on the server-side. I would urge you to actually go through the walkthrough steps first and not use the newly posted, completed solution ;-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9487638" width="1" height="1"&gt;</description></item><item><title>"Essential LINQ" book to be published tomorrow</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2009/03/10/essential-linq-book-to-be-published-tomorrow.aspx</link><pubDate>Wed, 11 Mar 2009 08:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9470136</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=9470136</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2009/03/10/essential-linq-book-to-be-published-tomorrow.aspx#comments</comments><description>&lt;p&gt;I have been underground for a while - trying to wrap up the LINQ book and working on some exciting stuff for Silverlight. For the latter, my lips are sealed until Mix 209. For the former, it is a different story ...&lt;/p&gt; &lt;p&gt;Last month, I finally finished all the prep work and so did my co-author Charlie Calvert. My editors from Addison Wesley tell me that the book is going to be out tomorrow. Here is the &lt;a href="http://www.informit.com/store/product.aspx?isbn=0321564162" mce_href="http://www.informit.com/store/product.aspx?isbn=0321564162"&gt;ToC&lt;/a&gt;&amp;nbsp; and here is the &lt;a href="http://www.amazon.com/Essential-LINQ-Microsoft-NET-Development/dp/0321564162/"&gt;Amazon&lt;/a&gt; listing. I am also adding the ToC to this post.&lt;/p&gt; &lt;p&gt;After Mix, I will have a lot more to say about how we are taking steps in the next interesting area - beyond DALs but I will keep quiet lest I divulge more than I am allowed to.&lt;/p&gt; &lt;p mce_keep="true"&gt;Dinesh&lt;/p&gt; &lt;p mce_keep="true"&gt;&amp;nbsp;&lt;/p&gt; &lt;p mce_keep="true"&gt;&lt;a href="http://www.amazon.com/Essential-LINQ-Microsoft-NET-Development/dp/0321564162/"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="244" alt="EssentialLINQ" src="http://blogs.msdn.com/blogfiles/dinesh.kulkarni/WindowsLiveWriter/EssentialLINQbooktobepublishedtomorrow_F9E7/EssentialLINQ_3.jpg" width="244" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p mce_keep="true"&gt;&lt;b&gt;&lt;span style="font-size: 13pt; font-family: 'Arial','sans-serif'"&gt;&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/p&gt; &lt;p mce_keep="true"&gt;&lt;b&gt;&lt;span style="font-size: 13pt; font-family: 'Arial','sans-serif'"&gt;Table of Contents&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;i&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Foreword&amp;nbsp; xxi&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;i&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Acknowledgments&amp;nbsp; xxv&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;i&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;About the Authors&amp;nbsp; xxix&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Introduction&amp;nbsp; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Getting Started&amp;nbsp; 13&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The Essence of LINQ&amp;nbsp; 39&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C# 3.0 Technical Overview&amp;nbsp; 65&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Writing Query Expressions&amp;nbsp; 129&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Query Operators&amp;nbsp; 175&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 7&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A Quick Tour of LINQ to SQL&amp;nbsp; 231&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Reading Objects with LINQ to SQL&amp;nbsp; 247&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Modifying Objects with LINQ to SQL&amp;nbsp; 281&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using Stored Procedures and Database Functions with LINQ to SQL&amp;nbsp; 319&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 11&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Customizing Entity Persistence and Adding Business Logic&amp;nbsp; 337&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINQ to Entities Overview&amp;nbsp; 349&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 13&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINQ to XML: Creation&amp;nbsp; 369&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 14&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Querying and Editing XML&amp;nbsp; 387&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XML Namespaces, Transforms, and Schema Validation&amp;nbsp; 423&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Introduction to LINQ Patterns and Practices&amp;nbsp; 465&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 17&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LINQ Everywhere&amp;nbsp; 487&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Chapter 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Conclusion&amp;nbsp; 515&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Appendix A&amp;nbsp;&amp;nbsp;&amp;nbsp; Tips for Developers&amp;nbsp; 519&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: 18pt"&gt;&lt;span style="font-size: 9.5pt; font-family: 'Arial','sans-serif'"&gt;Index&amp;nbsp; 547&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;p mce_keep="true"&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9470136" width="1" height="1"&gt;</description></item><item><title>.NET Framework 3.5 SP1: LINQ perf improvements (LINQ to Objects and LINQ to SQL)</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/08/10/net-fx-3-5-sp1-two-perf-improvements-linq-to-objects-and-linq-to-sql.aspx</link><pubDate>Mon, 11 Aug 2008 08:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8847562</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=8847562</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/08/10/net-fx-3-5-sp1-two-perf-improvements-linq-to-objects-and-linq-to-sql.aspx#comments</comments><description>&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;There are three perf improvements in the just released &lt;SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none"&gt;&lt;A href="http://msdn.microsoft.com/en-us/vstudio/products/cc533447.aspx" mce_href="http://msdn.microsoft.com/en-us/vstudio/products/cc533447.aspx"&gt;SP1&lt;/A&gt;&lt;/SPAN&gt;. As always, I will let you run your own microbenchmarks or more meaningful app-level benchmarks.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;STRONG&gt;LINQ to Objects: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Specialized enumerable: The new implementation recognizes queries that apply Where and/or Select to arrays or List&amp;lt;T&amp;gt;s and fold pipelines of multiple enumerable objects into single specialized enumerables. This produces substantial improvement in base overhead of common LINQ to Objects queries (at times 30+%).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;Cast&amp;lt;T&amp;gt; breaking change: This is a bug fix and a breaking change (see &lt;A href="http://blogs.msdn.com/ed_maurer/archive/2008/02/16/breaking-change-in-linq-queries-using-explicitly-typed-range-variables.aspx" mce_href="http://blogs.msdn.com/ed_maurer/archive/2008/02/16/breaking-change-in-linq-queries-using-explicitly-typed-range-variables.aspx"&gt;this&lt;/A&gt; post for background). The intended use of the NET FX 3.5 Cast&amp;lt;T&amp;gt; extension method is querying over non-generic collection types, whose elements require either a reference conversion or an unboxing step to be used in a generic query context. A late change VS 2008 cycle allowed the cast to succeed in more situations than intended, such as converting float values to int, where it should instead be throwing an InvalidCastException. The breaking change reverts the beta2 behavior and improves perf by simplifying the implementation of CastIterator&amp;lt;T&amp;gt;. Value conversions and explicitly-defined user conversions cause an &lt;B&gt;InvalidCastException&lt;/B&gt; instead of being allowed (as in RTM).&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'"&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt; stringList = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArrayList&lt;/SPAN&gt; { &lt;SPAN style="COLOR: #a31515"&gt;"foo"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"bar"&lt;/SPAN&gt; };&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'"&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt; intList = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArrayList&lt;/SPAN&gt; { 3, 4, 5 };&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'"&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt; strings = &lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; s &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; stringList&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&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 style="COLOR: blue"&gt;select&lt;/SPAN&gt; s;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'"&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt; ints = &lt;SPAN style="COLOR: blue"&gt;from&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt; i &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; intList&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;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;select&lt;/SPAN&gt; i;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;The above queries compile to &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'"&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt; strings = stringList.Cast&amp;lt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;&amp;gt;();&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'"&gt;var&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt; ints = intList.Cast&amp;lt;&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;&amp;gt;();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;You can imagine a simplified implementation&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Lucida Console'"&gt;static&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt; &lt;SPAN style="COLOR: #2b91af"&gt;IEnumerable&lt;/SPAN&gt;&amp;lt;T&amp;gt; CastIterator&amp;lt;T&amp;gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IEnumerable&lt;/SPAN&gt; source)&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt;{&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt; (&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; obj &lt;SPAN style="COLOR: blue"&gt;in&lt;/SPAN&gt; source) &lt;SPAN style="COLOR: blue"&gt;yield&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; (T)obj;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Lucida Console'"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;STRONG&gt;LINQ to SQL: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;This too is a bug fix. The original intent was to optimize id-based queries that are expected to return singletons. If an entity with a matching key value is already in the DataContext identity cache, then translating the query to SQL and executing it against the database is a pure waste of time since the retrieved row is promptly thrown away to avoid stomping on user's existing object. Now that bug has been fixed. So an id-based query will not cause a trip to the database. This results in a dramatic perf improvement (one hash table lookup instead of SQL translation + SQL query execution) in an admittedly narrow but common scenario.&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;BTW, as mentioned in a previous post, I haven't worked on either component for SP1. But I have been deeply involved in them for 3.5 RTM so I can't resist tracking such sweet changes. Besides, I am working on a &lt;A class="" href="http://www.informit.com/authors/bio.aspx?a=cf8c0e31-2c75-4e3b-8079-06bc394eb839" mce_href="http://www.informit.com/authors/bio.aspx?a=cf8c0e31-2c75-4e3b-8079-06bc394eb839"&gt;LINQ book&lt;/A&gt; that keeps me very involved with the components.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Dinesh&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8847562" width="1" height="1"&gt;</description></item><item><title>Templated code gen for LINQ to SQL</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/08/07/templated-code-gen-for-linq-to-sql.aspx</link><pubDate>Fri, 08 Aug 2008 07:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8842356</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=8842356</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/08/07/templated-code-gen-for-linq-to-sql.aspx#comments</comments><description>&lt;P&gt;This is going to be a brief one. If you are using LINQ to SQL, you should check out Damien's new &lt;A class="" href="http://damieng.com/blog/2008/07/23/linq-to-sql-t4-template-reloaded" mce_href="http://damieng.com/blog/2008/07/23/linq-to-sql-t4-template-reloaded"&gt;templated code generator&lt;/A&gt; sample. One of our regrets from LINQ to SQL V1 days was not providing an easy way to tailor the code-gen. This is one step in that direction.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Another major step would be to preserve "excluded" tables/columns/sprocs/... in dbml. So any change in schema can be handled appropriately as new/deleted database object (a rename could be treated as a removed column and an added column from metadata perspective).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Dinesh&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8842356" width="1" height="1"&gt;</description></item><item><title>Relational-Object-XML-Object with LINQ to SQL &amp; LINQ to XML</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/07/27/relational-object-xml-object-with-linq-to-sql-xml.aspx</link><pubDate>Mon, 28 Jul 2008 08:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8782530</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=8782530</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/07/27/relational-object-xml-object-with-linq-to-sql-xml.aspx#comments</comments><description>&lt;P&gt;This is old story and I have used parts of it over the last three years to show how LINQ lets you navigate from relational (R)&amp;nbsp;to object (O) or object to XML (X) etc. But for a forthcoming demo, I had to write some quick code today and it looked like it might be worth sharing. So here it is ...&lt;/P&gt;
&lt;P&gt;A little background first: I need to show a 3-tier app where the mid-tier can use a variety of Data Acccess Layers or DALs (not just LINQ to SQL &lt;IMG alt=smile_sad src="http://spaces.live.com/rte/emoticons/smile_sad.gif"&gt; ). A good way to show that is how you can use POCO classes with some extra info. An easy way to populate it is from an XML file. But I would like to continue the demo and show a real DAL talking to a real DB and it would be good to have consistent storyboard and data. So I decided to extract a small subset of AdventureWorks data - Employee-PurchaseOrderHeader-PurchaseOrderDetail into an XML file and then use that file for the first part. So what I have is a nice trip across the three domains: R-&amp;gt; O -&amp;gt; X (file) -&amp;gt; O.&lt;/P&gt;
&lt;P&gt;Here is the R-O-X part. The object model is crafted up in the LINQ to SQL designer with a bunch of unrelated foreign keys (FK) eliminated. I won't repeat it since you can easily create it with drag-drop-member delete gestures in the designer.&lt;/P&gt;
&lt;P&gt;Caution - this is all just a quick and dirty shell to get going. It is not robust with respect to missing files, changed data, test code etc. That is left to you as an exercise &lt;IMG alt=smile_wink src="http://spaces.live.com/rte/emoticons/smile_wink.gif"&gt;&lt;/P&gt;&lt;PRE class=code&gt;AWExtractDataContext db = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;AWExtractDataContext(&lt;SPAN style="COLOR: #a31515"&gt;@"C:\Northwind\AdventureWorks_Data.mdf"&lt;/SPAN&gt;);
db.Log = &lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.Out;

&lt;SPAN style="COLOR: green"&gt;// Preselected employees based on browsing of data
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;var &lt;/SPAN&gt;EmpList = (&lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;e &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;db.Employees
              &lt;SPAN style="COLOR: blue"&gt;where &lt;/SPAN&gt;((e.EmployeeID &amp;gt; 240) &amp;amp;&amp;amp; (e.PurchaseOrderHeaders.Any()))
              &lt;SPAN style="COLOR: blue"&gt;select &lt;/SPAN&gt;e).ToList();
&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"\nNumber of employees: {0}\n"&lt;/SPAN&gt;,EmpList.Count);

&lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;var &lt;/SPAN&gt;e &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;EmpList)
{
    &lt;SPAN style="COLOR: green"&gt;// Select only five POs per employee
    &lt;/SPAN&gt;e.POList = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;PurchaseOrderHeader&amp;gt;(e.PurchaseOrderHeaders.Take(5));
    e.PurchaseOrderHeaders = &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;;
}

&lt;SPAN style="COLOR: green"&gt;// Write out a single XML hierarchy with some additional denormalized data
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;var &lt;/SPAN&gt;EmpXML = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XElement(&lt;SPAN style="COLOR: #a31515"&gt;"Employees"&lt;/SPAN&gt;,
                &lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;e &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;EmpList
                &lt;SPAN style="COLOR: blue"&gt;select new &lt;/SPAN&gt;XElement(&lt;SPAN style="COLOR: #a31515"&gt;"Employee"&lt;/SPAN&gt;,
                 &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"EmployeeID"&lt;/SPAN&gt;, e.EmployeeID),
                 &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"LoginID"&lt;/SPAN&gt;, e.LoginID),
                 &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"ManagerID"&lt;/SPAN&gt;, e.ManagerID),
                 &lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;po &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;e.POList
                 &lt;SPAN style="COLOR: blue"&gt;select new &lt;/SPAN&gt;XElement((&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrder"&lt;/SPAN&gt;),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrderID"&lt;/SPAN&gt;, po.PurchaseOrderID),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"Status"&lt;/SPAN&gt;, po.Status),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"EmployeeID"&lt;/SPAN&gt;, po.EmployeeID),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"OrderDate"&lt;/SPAN&gt;, po.OrderDate),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"ShipDate"&lt;/SPAN&gt;, po.ShipDate),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"SubTotal"&lt;/SPAN&gt;, po.SubTotal),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"TaxAmt"&lt;/SPAN&gt;, po.TaxAmt),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"Freight"&lt;/SPAN&gt;, po.Freight),
                  &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"TotalDue"&lt;/SPAN&gt;, po.TotalDue),
                  &lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;det &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;po.PurchaseOrderDetails
                  &lt;SPAN style="COLOR: blue"&gt;select new &lt;/SPAN&gt;XElement((&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrderDetail"&lt;/SPAN&gt;),
                   &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrderID"&lt;/SPAN&gt;, po.PurchaseOrderID),
                   &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrderDetailID"&lt;/SPAN&gt;, det.PurchaseOrderDetailID),
                   &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"ProductID"&lt;/SPAN&gt;, det.ProductID),
                   &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"ProductName"&lt;/SPAN&gt;, det.ProductName),
                   &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"OrderQty"&lt;/SPAN&gt;, det.OrderQty),
                   &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"UnitPrice"&lt;/SPAN&gt;, det.UnitPrice),
                   &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;XAttribute(&lt;SPAN style="COLOR: #a31515"&gt;"LineTotal"&lt;/SPAN&gt;, det.LineTotal)
                   )
                  )
                )
               );

EmpXML.Save(&lt;SPAN style="COLOR: #a31515"&gt;@"C:\temp\AWEmpPOs.xml"&lt;/SPAN&gt;);
&lt;/PRE&gt;
&lt;P&gt;Here is a small portion of the XML from the file.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Employees&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
  &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Employee &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;EmployeeID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;241&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;LoginID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;adventure-works\eric2&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;ManagerID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;274&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;PurchaseOrder &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;PurchaseOrderID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;3&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;Status&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;4&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;EmployeeID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;0&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;OrderDate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;2001-05-17T00:00:00&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;ShipDate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;2001-05-26T00:00:00&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;SubTotal&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;8847.3000&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;TaxAmt&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;707.7840&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;Freight&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;221.1825&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;TotalDue&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;9776.2665&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
      &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;PurchaseOrderDetail &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;PurchaseOrderID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;3&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;PurchaseOrderDetailID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;4&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;ProductID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;530&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;ProductName&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;Seat Post&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;OrderQty&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;550&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;UnitPrice&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;16.0860&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;LineTotal&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;8847.3000&lt;/SPAN&gt;" &lt;SPAN style="COLOR: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;PurchaseOrder&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;BR&gt;...&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;Now in another project, I just took the XML file and created the object hierarchy. This time, I did NOT use any LINQ to SQL or any other DAL-generated classes. I won't bother showing all the POCO classes since the initializer shows you the members and types anyway. But the classes are hand-coded with the auto-implemented properties feature as follows:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;public class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Employee
&lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;public int &lt;/SPAN&gt;EmployeeID { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }
    &lt;SPAN style="COLOR: blue"&gt;public string &lt;/SPAN&gt;LoginID { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }
    &lt;SPAN style="COLOR: blue"&gt;public int&lt;/SPAN&gt;? ManagerID { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }
    &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;PurchaseOrder&lt;/SPAN&gt;&amp;gt; POs { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;set&lt;/SPAN&gt;; }        
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P mce_keep="true"&gt;The code to populate the object graph is as follows (hierarchy first and backpatching later)&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: #2b91af"&gt;XElement &lt;/SPAN&gt;Emps = &lt;SPAN style="COLOR: #2b91af"&gt;XElement&lt;/SPAN&gt;.Load(&lt;SPAN style="COLOR: #a31515"&gt;@"C:\temp\AWEmpPOs.xml"&lt;/SPAN&gt;);

&lt;SPAN style="COLOR: blue"&gt;var &lt;/SPAN&gt;EmpFromXML =   
        &lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;e &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;Emps.Elements()
        &lt;SPAN style="COLOR: blue"&gt;select new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Employee
        &lt;/SPAN&gt;{
            EmployeeID = (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;) e.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"EmployeeID"&lt;/SPAN&gt;),
            LoginID = (&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;) e.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"LoginID"&lt;/SPAN&gt;),
            ManagerID = (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;) e.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"ManagerID"&lt;/SPAN&gt;),
            POs = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;PurchaseOrder&lt;/SPAN&gt;&amp;gt;(
                &lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;po &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;e.Elements()
                &lt;SPAN style="COLOR: blue"&gt;select new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;PurchaseOrder &lt;/SPAN&gt;{                                
                    PurchaseOrderID = (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;) po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrderID"&lt;/SPAN&gt;),
                    Status = (&lt;SPAN style="COLOR: blue"&gt;byte&lt;/SPAN&gt;) (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;) po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"Status"&lt;/SPAN&gt;),
                    EmployeeID = (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;) po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"EmployeeID"&lt;/SPAN&gt;),
                    OrderDate = (&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;) po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"OrderDate"&lt;/SPAN&gt;), 
                    ShipDate = (&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;?) po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"ShipDate"&lt;/SPAN&gt;),
                    SubTotal = (&lt;SPAN style="COLOR: blue"&gt;decimal&lt;/SPAN&gt;) po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"SubTotal"&lt;/SPAN&gt;),
                    TaxAmt = (&lt;SPAN style="COLOR: blue"&gt;decimal&lt;/SPAN&gt;)po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"TaxAmt"&lt;/SPAN&gt;),
                    Freight = (&lt;SPAN style="COLOR: blue"&gt;decimal&lt;/SPAN&gt;)po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"Freight"&lt;/SPAN&gt;),
                    TotalDue = (&lt;SPAN style="COLOR: blue"&gt;decimal&lt;/SPAN&gt;)po.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"TotalDue"&lt;/SPAN&gt;),
                    Details = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;PurchaseOrderDetail&lt;/SPAN&gt;&amp;gt; (
                        &lt;SPAN style="COLOR: blue"&gt;from &lt;/SPAN&gt;det &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;po.Elements()
                        &lt;SPAN style="COLOR: blue"&gt;select new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;PurchaseOrderDetail &lt;/SPAN&gt;{
                            PurchaseOrderID = (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)det.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrderID"&lt;/SPAN&gt;),
                            PurchaseOrderDetailID = (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)det.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"PurchaseOrderDetailID"&lt;/SPAN&gt;),
                            ProductID = (&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)det.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"ProductID"&lt;/SPAN&gt;),
                            ProductName = (&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;)det.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"ProductName"&lt;/SPAN&gt;),
                            OrderQty = (&lt;SPAN style="COLOR: blue"&gt;short&lt;/SPAN&gt;)det.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"OrderQty"&lt;/SPAN&gt;),
                            UnitPrice = (&lt;SPAN style="COLOR: blue"&gt;decimal&lt;/SPAN&gt;)det.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"UnitPrice"&lt;/SPAN&gt;),
                            LineTotal = (&lt;SPAN style="COLOR: blue"&gt;decimal&lt;/SPAN&gt;)det.Attribute(&lt;SPAN style="COLOR: #a31515"&gt;"LineTotal"&lt;/SPAN&gt;)
                        }
                        )
                }
              )
        };

&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Employee&lt;/SPAN&gt;&amp;gt; EmpList = EmpFromXML.ToList();

&lt;SPAN style="COLOR: green"&gt;// Backpatch the references based on collection membership
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;foreach&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;Employee &lt;/SPAN&gt;e &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;EmpList)
    &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;PurchaseOrder &lt;/SPAN&gt;po &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;e.POs)
    {
        po.Employee = e;
        &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;PurchaseOrderDetail &lt;/SPAN&gt;det &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;po.Details)
            det.PurchaseOrder = po;
    }

&lt;SPAN style="COLOR: green"&gt;// Show some of the constructed graph
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ObjectDumper&lt;/SPAN&gt;.Write(EmpList.First(), 1);&lt;/PRE&gt;
&lt;P&gt;I found it quite easy and quick to roll this up. You might find it useful where you need to combine data from the three domains and go back and forth.&lt;/P&gt;
&lt;P&gt;Dinesh&lt;/P&gt;
&lt;P&gt;P.S. &lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;In case you haven't used it before, ObjectDumper is the new incarnation of Console.WriteLine(). It shipped as a sample with Visual Studio 2008 in source form so you will need to build it into a DLL and add a reference to your project. It is well worth it. 
&lt;LI&gt;Before you say it ... When you have a hammer, everything looks like a nail. But LINQ is an awesome hammer - it often works better than screwdrivers and spanners &lt;IMG alt=smile_regular src="http://spaces.live.com/rte/emoticons/smile_regular.gif"&gt; 
&lt;LI&gt;I could have used a smart collection to backpatch the reference to the parent object but I just got lazy and wrote some imperative code that traverses the hierarchy again.&lt;/LI&gt;&lt;/OL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8782530" width="1" height="1"&gt;</description></item><item><title>LINQ to SQL Tips 9: Understanding DataContext's internal caching </title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/07/01/linq-to-sql-tips-9-understanding-datacontext-s-internal-caching.aspx</link><pubDate>Wed, 02 Jul 2008 07:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8680059</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=8680059</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/07/01/linq-to-sql-tips-9-understanding-datacontext-s-internal-caching.aspx#comments</comments><description>&lt;P&gt;Back to the "tips" series after a little break ...&lt;/P&gt;
&lt;P&gt;One common question I get is about caching of data in LINQ to SQL. It means a lot of different things so let's start with the following baseline: LINQ to SQL was designed to get you objects from the database and to submit the changes back to the database. It is not intended to be a mid-tier caching component. It is not a cache and it does not pretend to be one. However, it does have certain behaviors that are interesting in this regard:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Object identity&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;If you want to be able to update the objects you retrieve from the database, it helps to avoid multiple copies of the objects. LINQ to SQL maintains an internal "identity cache" to ensure that within the scope of a DataContext, there will be at most one instance of a given type for a given key value. Think of it like a dictionary indexed by the key value (whether single column or composite key) that stores entities. When you enumerate the results of a query, DataContext looks at each row returned by the underlying DataReader, checks if an instance with the same key value already exists in the dictionary. If an entity is found, it throws away the row and just returns you the existing object from the identity cache. (For those who are more curious, you can look at DataContext.cs, IdentityManager.cs in the sources). As described in another post, we don't stomp on your copy while materializing objects (unless you ask for that using Refresh())&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Change tracking&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;After query execution, you are out of the relational world and into the brave world of objects. There the currency for identity is an object reference rather than a key value since APIs take in objects and not rows or key values. So we also maintain a dictionary that can be looked up by the object. Among many other things, it helps us Attach() a new object by starting to track it. &lt;/P&gt;
&lt;P&gt;Enough of the internal view. What does it mean for you?&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;LINQ to SQL is designed for retrieving and saving objects. Any caching it does is to that end and not for general purpose use you may have. There are other cache components you can look at.&lt;/LI&gt;
&lt;LI&gt;By and large, DataContext holds a reference to an&amp;nbsp;entity that it materializes for the life of the DataContext and keeps it as is unless you explicitly modify it or &lt;A class="" href="http://blogs.msdn.com/dinesh.kulkarni/archive/2008/05/23/linq-to-sql-tips-6-how-to-refresh-given-datacontext-won-t-stomp-on-your-objects.aspx" mce_href="http://blogs.msdn.com/dinesh.kulkarni/archive/2008/05/23/linq-to-sql-tips-6-how-to-refresh-given-datacontext-won-t-stomp-on-your-objects.aspx"&gt;Refresh()&lt;/A&gt; it.&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;You can ask for it by the key value and retrieve it without remote query (this bug is getting fixed in SP1)&lt;/LI&gt;
&lt;LI&gt;DataContext feels like&amp;nbsp;it has an&amp;nbsp;obsessive possessive disorder. You can't really take away an object from it. It would rather be disposed than give up the precious entities it holds on to. If you don't like the fact that a reference is maitained (i.e. you want to have entities garbage collected), then use the disposable pattern. See &lt;A class="" href="http://blogs.msdn.com/dinesh.kulkarni/archive/2008/04/27/lifetime-of-a-linq-to-sql-datacontext.aspx" mce_href="http://blogs.msdn.com/dinesh.kulkarni/archive/2008/04/27/lifetime-of-a-linq-to-sql-datacontext.aspx"&gt;this post&lt;/A&gt; for more information.&lt;/LI&gt;&lt;/OL&gt;
&lt;LI&gt;Over time, the entities in the id cache&amp;nbsp;get more and more stale. Fine for reference data; not OK for data that changes in the database more often.&lt;/LI&gt;
&lt;LI&gt;The internal caches make DataContext a write-back cache rather than a write-through cache. We write back on SubmitChanges().&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Attach() might look like an Add() on the cache (and it does behave like it in some ways), but it is &lt;A class="" href="http://blogs.msdn.com/dinesh.kulkarni/archive/2007/10/08/attach-if-you-have-something-detached.aspx" mce_href="http://blogs.msdn.com/dinesh.kulkarni/archive/2007/10/08/attach-if-you-have-something-detached.aspx"&gt;designed for tracking the object&lt;/A&gt; for further changes. &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Non-entities don't show up in the internal cache - there is no key for lookup. Most common case of non-entity is a result from a sproc that does not match the shape of an entity. &lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Turning ObjectTrackingEnabled off can give you a small perf boost - may be useful in a read-only app (only).&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;Dinesh&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8680059" width="1" height="1"&gt;</description></item><item><title>An account of Bill Gates' farewell</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/06/28/an-account-of-billg-farewell.aspx</link><pubDate>Sun, 29 Jun 2008 00:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8664910</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=8664910</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/06/28/an-account-of-billg-farewell.aspx#comments</comments><description>&lt;P&gt;An unusual subject for this blog that has been mostly about components I have worked on. But the event yesterday was memorable and worth sharing. The &lt;A class="" href="http://www.microsoft.com/presspass/presskits/leadership/video.mspx" mce_href="http://www.microsoft.com/presspass/presskits/leadership/video.mspx"&gt;event&lt;/A&gt; has been covered widely so I won't even try to broadly summarize. Insted I will list what I found interesting. I was lucky enough (one of 2k lottery winners out of maybe 20+k who were interested) to get a seat for in-person viewing.&lt;/P&gt;
&lt;P&gt;There is no substitute to hearing from the man himself and his business partner of 28 years (and a friend/associate of 35 years or so) Steve Ballmer. The range of topics chosen was very enlightening - from "How did your parents react to you dropping out" to "What was the biggest screw up and what did you learn from it". Here are three things I took away from it:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Trust and personal networks matter the most&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no substitute for personal networks and personal trust and gut instinct. For all the talk of globalization, outcome/evidence-based hiring and rewards, creative processes like forming businesses are deeply personal rather than global; intuitive rather than analytical and grounded in optimism/aspirations rather than backward looking statistics. Maybe the takeaway suits my personality profile but I am always uneasy about decision making processes that try to reduce human judgement to an automaton. SteveB was a known quantity, his passion and intelligence was vetted long before there was any Microsoft, let alone a job opening.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;How others see you differs from your self-model&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Peronal motivations and self-image can be very far apart from the motivations attributed by others to you and their image of you. This gap is very important to understand. I was not an MS employee during the major anti-trust proceedings. But after hearing from BillG and SteveB about their mindset and approach and after hearing quixotic evil intentions attribute to my team and I during the last few years, I think the aforementioned gap explains a lot.I won't even bother talking about our good intentions. That is too touchy feely. But from what I have seen, my colleagues in various teams and I are so preoccupied with building what we are building and getting it out the door (before it gets killed for some bizarre internal reasons :-) ) that we have no time or smarts left to even think about doing any sinister things. Let alone plan for it years in advance and execute on it to perfection. Heck, like software engineers everywhere, we have a tough time estimating and meeting the estimates for the most basic product/component we would like to ship.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Decisions are based on aspiration and hope rather than just analytics&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;There is no shortage of blog posts or news items calling for radical strategy/personnel/... change. Most wonder why those in the position of power cannot see what the numbers and facts show. A lot is based on intuition about strategy/leadership/vision that can be counter to facts on the ground at a particular point in time. That doesn't validate the intuition or negate the facts. It simply means that it is futile to look for the fact-based-decision making automaton. Hear the vision, strategy and then lead. follow or get out based on your personal judgement.&lt;/P&gt;
&lt;P&gt;Like the takeaways, my process of arriving at them was deeply personal. Take it (or not) FWIW.&lt;/P&gt;
&lt;P&gt;Dinesh&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8664910" width="1" height="1"&gt;</description></item><item><title>Design of LINQ to SQL - What was I thinking or was I?</title><link>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/06/24/design-of-linq-to-sql-and-core-linq-what-were-we-thinking.aspx</link><pubDate>Wed, 25 Jun 2008 08:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8651029</guid><dc:creator>Dinesh Kulkarni - MSFT</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.msdn.com/b/dinesh.kulkarni/rsscomments.aspx?WeblogPostID=8651029</wfw:commentRss><comments>http://blogs.msdn.com/b/dinesh.kulkarni/archive/2008/06/24/design-of-linq-to-sql-and-core-linq-what-were-we-thinking.aspx#comments</comments><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;A little break from my "LINQ to SQL tips" series of posts. A recent &lt;A class="" href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/" mce_href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/"&gt;vote of no confidence&lt;/A&gt; on a related component orchestrated by community activists reminded me of many questions I have fielded and how the design team approached the design of LINQ to SQL (and also core LINQ APIs and C# language changes for LINQ). Nah, that��s for another day when it is cloudy and raining.&amp;nbsp;Instead, let’s talk about my recent dream. Or rather, a&amp;nbsp;nightmare!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;But first turn off your flame throwers, grab a cup of coffee and don't take this too seriously ...&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;I had this Q&amp;amp;A&amp;nbsp;nightmare about the component I worked on - LINQ to SQL. I am the "expert" providing the non-answers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: How do I&amp;nbsp;use blah pattern with LINQ to SQL (e.g. blah = ActiveRecord if&amp;nbsp;you don't like&amp;nbsp;abstract concepts)&lt;BR&gt;A: You don't!&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: I think I wasn't sufficiently clear. I stood on one leg and when the phase of the moon was 64% of full, it worked but now that the moon is waxing further, your foo method throws bar exception when I do baz. How do I just get that bit working with LINQ to SQL. &lt;BR&gt;A: You don't&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: (By now quite upset) Do you even understand blah?&lt;BR&gt;A: (Forced to be less terse) Yes. We considered blah and decided against it for a set of reasons listed below. That pattern is not consistent with the core design assumptions and recommended usage patterns with LINQ to SQL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: (Now a full-force verdict) I hearby find you guilty of violating the implicit agreement to solve the world hunger problem using blah methodology.&amp;nbsp;Hence, what you produced is useless, evil and must be stopped at once. Any software built using your component will accelerate global warming and cause all glaciers to melt at once. And of course, it will irreparably damage the young and impressionable minds of generations of developers leaving them utterly useless for anything except writing some old fashioned code.&lt;BR&gt;A: Thank you for your interest in LINQ to SQL err blah.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Nightmare aside,&amp;nbsp;(what) were we thinking? Stay tuned for&amp;nbsp;that ...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;P.S.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #c0504d; mso-themecolor: accent2"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;1. This release includes backward-looking statements intended to qualify for the safe harbor from liability established by the Public Flagellation by Community&amp;nbsp;Act of 2008. These backward-looking statements generally can be identified by phrases such as "did", "was", "thought" ... and by the absence of "will" "fix" "in future release".&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #c0504d; mso-themecolor: accent2"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;2.&amp;nbsp;I just wanted to get you objects from the table. I swear. Nothing more than that!&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=3&gt;&lt;SPAN style="COLOR: #c0504d; mso-themecolor: accent2"&gt;&lt;FONT face=Calibri&gt;3. Scott B., if you are reading this, peace! I won't let you drag me on to the stage at another PDC BoF and I won't fix anything either. I can't. I don't drive LINQ to SQL anymore. I just drive righteous developers crazy &lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #c0504d; FONT-FAMILY: Wingdings; mso-themecolor: accent2; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;&lt;SPAN style="mso-char-type: symbol; mso-symbol-font-family: Wingdings"&gt;J&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN style="COLOR: #c0504d; mso-themecolor: accent2"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8651029" width="1" height="1"&gt;</description></item></channel></rss>