I had a blast on the Geek Speak today. If you missed it, they will have it available on demand from their blog at http://blogs.msdn.com/geekspeak/. You can even subscribe to the audio feed using your the Zune podcasting functionality from their rss feed. One of the things I love about these events is the variety of the questions that attendees bring.
As I mentioned, the slide deck I used for the session is available in the Files section here as Linq Migration Strategies.
Below are some of the questions that came up and some links to back up my answer for your reading edification.
Q: How do you import schema into VB at the top of the file, if schema is in project it will give you intellisense?
Beth Massi and Avner Aharoni demonstrate this in the webcast available at http://blogs.msdn.com/bethmassi/archive/2008/01/18/channel-9-interview-xml-properties-and-enabling-intellisense.aspx. They also demonstrate generating the schema from a sample XML document.
Q: How would you replace an existing data layer with LINQ to SQL?
I started showing how to take the Personal Web Starter Kit and begin to LINQ enable it. The completed project is available at http://code.msdn.microsoft.com/LinqPersonalWeb.
Q: How does LINQ perform as compared to the other alternatives?
Any time you add a level of indirection there will be some performance penalty. With LINQ to Objects, they basically leverage the iterator pattern the same way the C# 2.0 Yield method works. For LINQ to SQL, the best series on performance is from Rico Mariani starting with http://blogs.msdn.com/ricom/archive/2007/06/22/dlinq-linq-to-sql-performance-part-1.aspx
Q: Where can we find patterns and practices guidance on LINQ
This post is more along the lines of the Framework Design Guidelines book, but it is good information anyway: http://blogs.msdn.com/mirceat/archive/2008/03/13/linq-framework-design-guidelines.aspx
There is also a Live from Redmond VB9 webcast discussing best practices at http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032337466
Additional "How do I" videos are available at http://msdn2.microsoft.com/en-us/vbasic/bb466226.aspx
Q: What advice do you have for passing data across tiers? If we can’t pass context across tiers, can we pass resultant objects?
There isn't really a single difinitive post on this one. Searching for "DataContext" and "Short lived" or "Unit of work" should supply a number of examples, including the following:
This forum post includes responses by Keith Farmer and Matt Warren who were both intimately involved with creating LINQ to SQL: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2485909&SiteID=1. Matt states, "You'll most often want a new context for every interesting unit of work. DataContext's should be short lived if they can be. The only scenario where you'd keep a DataContext around for a long time would be if you were bulding the equivalent of a 2-tier UI based data-entry/editting appliction."
Dino Esposito notes: http://weblogs.asp.net/despos/archive/2008/03/19/more-on-datacontext-in-hopefully-a-realistic-world.aspx
Some additional resources mentioned:
Rick Strahl: http://www.west-wind.com/weblog/default.aspx
Beth Massi: http://blogs.msdn.com/bethmassi/
MSDN LINQ forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=123&SiteID=1
Q: Regarding Linq to Entities, I hear that the entities will not use the same change tracking model to permit emitting across tiers, by making the EntitySets serializable and have the changes tracked on a set by set basis, can you confirm deny? Info on this?
I don't know enough to comment on this. I would recommend asking the question on the ADO.NET Entity Framework forum at http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=533&SiteID=1.
Crossposted from ThinqLinq.com