[System.Data] Delay column expression evaluation after all the columns have been...
commit36469066f58233829f0ff36aab06a3d9aafea331
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 13 Sep 2011 12:02:51 +0000 (13 14:02 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Tue, 13 Sep 2011 12:07:27 +0000 (13 14:07 +0200)
treee46297e73f6b9502e8072d6af7742d5b75a15f71
parent6c7d6c034a76886e4bd1b9a0b8b700378c758299
[System.Data] Delay column expression evaluation after all the columns have been cloned when cloning a table. Fixes #666.

When cloning a table we loop over all the columns and clone them, but if a column
contains an expression with a reference to a later column, we'll throw an exception
unless we delay the expression compilation until all the columns have been added
to the new table clone.

So I've split out the expression compilation logic from the Expression property setter,
and now the column Clone method only sets the field. The Clone caller is responsible
for calling CompileExpression on the cloned column after adding all the cloned columns to
the cloned table.
mcs/class/System.Data/System.Data/DataColumn.cs
mcs/class/System.Data/System.Data/DataTable.cs
mcs/class/System.Data/Test/System.Data/DataTableTest.cs