Thanks to everyone who attended my LINQ to SQL presentation at RockNUG last night. The code samples can be downloaded here: LINQ to SQL demo code.
As a point of clarification from last night's Q&A session after the presentation regarding using LINQ to SQL with true POCO classes that do not even have [Column] mapping attributes, you can have a class like this:
public class Contact { public int ID; public string FirstName { get; set; } public string LastName { get; set; } public string Title { get; set; } }
If you're using LINQ to SQL with stored procedures then this class (even without the [Column] attributes) will work just fine. The one catch is that you can not have the class itself decorated with the [Table] attribute which is what happened during the Q&A at the end of last night when someone asked me to show it work without attributes. I commented the [Column] attribute but did not also comment the [Table] attribute on the class level. If I had also commented out the [Table] attribute, however, then I would have run into this (different issue) because of the "extra" HomeAddress and BusinessAddress properties I added to the partial class (so bear that in mind if you test).
If you watch my blog in the next couple of days (or just subscribe to the rss feed) I'll put up a post dedicated strictly to the various mapping options you have with LINQ to SQL and downloadable code examples of each since the only mapping I showed last night was the attributed-based mapping (e.g., mapping with attributes, mapping with XML, mapping differences with auto-generated SQL vs. stored proces, mapping with true POCO, etc.). Thanks!