C
Chris
Hi,
We want different row types at the same time in a DataTable. The idea behind
this is to support a kind of inheritance in a table. To do this, we had
overridden the NewRowFromBuilder method. Then we select the row type
construction using a special column that contains the type of the database
record type. All row type inherit from DataRow, but they have a common set
of columns and additional columns according to each type. Top base class is
TPersons
TCustomers and TEmployees inherit from TPersons
TSpecializedCustomers inherits from TCustomers.
Actually we have succeeded using the following code at the Fill time. When
we the Merge and the GetChanges method, will get the following message "This
row has been removed from a table and does not have any data. BeginEdit()
will allow creation of new data in this row." at the line A. I know that
methods called by Fill are not the same as the GetChanges method.
protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
TPersonsRow newBaseRow = new TPersonsRow(builder);
(A) string RowType = (string)newBaseRow[columnRXClassType];
if (RowType == "TEmployees") { return new TEmployeesRow(builder); }
if (RowType == "TCustomers") { return new TCustomersRow(builder); }
if (RowType == "TSpecializedCustomers") { return new
TSpecializedCustomersRow(builder); }
return newBaseRow;
}
I just want a idea of how I can overcome this issue. We already did
implement the same concept in earlier version of ADO and now we are trying
to migrate to ADO.NET. But we are not sure, the thing is we cannot migrate
if we cannot support inheritance like we have already done.
Thanks!
We want different row types at the same time in a DataTable. The idea behind
this is to support a kind of inheritance in a table. To do this, we had
overridden the NewRowFromBuilder method. Then we select the row type
construction using a special column that contains the type of the database
record type. All row type inherit from DataRow, but they have a common set
of columns and additional columns according to each type. Top base class is
TPersons
TCustomers and TEmployees inherit from TPersons
TSpecializedCustomers inherits from TCustomers.
Actually we have succeeded using the following code at the Fill time. When
we the Merge and the GetChanges method, will get the following message "This
row has been removed from a table and does not have any data. BeginEdit()
will allow creation of new data in this row." at the line A. I know that
methods called by Fill are not the same as the GetChanges method.
protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
TPersonsRow newBaseRow = new TPersonsRow(builder);
(A) string RowType = (string)newBaseRow[columnRXClassType];
if (RowType == "TEmployees") { return new TEmployeesRow(builder); }
if (RowType == "TCustomers") { return new TCustomersRow(builder); }
if (RowType == "TSpecializedCustomers") { return new
TSpecializedCustomersRow(builder); }
return newBaseRow;
}
I just want a idea of how I can overcome this issue. We already did
implement the same concept in earlier version of ADO and now we are trying
to migrate to ADO.NET. But we are not sure, the thing is we cannot migrate
if we cannot support inheritance like we have already done.
Thanks!