Time for some Google juice. With any luck someone from the Smart Client Data or DataWorks team will pick this up and let me know what's going on.

ADO.NET 2.0 introduces a new event to DataTable. It's called 'TableNewRow', and it gets called whenever you create a new DataRow in the table. Re-read that: It's not when you add a row to the table, it's when you create a new row. So this code:

 DataRow newRow = myTable.NewRow(); 

... would raise a TableNewRow event.

Now, according to the .NET guidelines for designing classes (as I understand them) events are raised from protected methods that begin with "On" and end with the name of the event. To wit: DataTable now has a virtual method called OnTableNewRow, which you can override if you derive from DataTable (in strongly-typed DataSets, for example). OnTableNewRow is great for initializing fields with values that can only be initialized at runtime, like Guids.

But there's a problem.

DataTable.OnTableNewRow doesn't get called unless someone has handled the TableNewRow event.

If you add an OnTableNewRow override to your DataTable-derived class, the code will never get called. There's an easy fix - you just do this somewhere:

 myTable.TableNewRow += delegate(object sender, DataTableNewRowEventArgs e) { }; 

Now the TableNewRow event is handled, and OnTableNewRow gets fired.

This "feature" exists even in the recently-released C# Express edition, so consider yourself warned!