While doing code reviews (for .net code, of course!),  I see one minor annoyance with strongly typed datasets again and again - not using the TableName property.  I don't know why this comes up so often, so I thought I'd add a quick tip about it.

If you have a strongly typed dataset (some call them XSD datasets), great. You don't need to remember column names or worry about casting values.  So why do I see things like this:

dAdapter.TableMappings.Add("Table1", "MyTable");
//or
cntrl.DataMember("MyTable");

Instead of using the table's name as a string, use the .TableName property as such:

dAdapter.TableMappings.Add("Table1", typedSet.MyTable.TableName);
//or
cntrl.DataMember(typedSet.MyTable.TableName);

 

Now you can rename your table and let the compiler find all of the code you need to change, instead of trying to do a “Find” and hoping you didn't miss any.  I'm all about making the compiler find as many problems as I can.