Datasets reset Readonly flag

posted Dec 12, 2017, 4:01 PM by Chad Boyer   [ updated Dec 12, 2017, 5:53 PM by Eric Patrick ]
The introduction of AbstractObject.ExecuteDataSetAsync uses Database.ExecuteReaderAsync, loading the DataReader into a DataSet, since SqlDatabase does not have a native ExecuteDataSetAsync method. This has an unintended side effect: each column in the DataSet is marked as read-only (DataColumn.ReadOnly = true). This side effect is only an issue when the application tier attempts to modify the data set in memory, such as is done with USPSCertified mailing plugin.

To address this issue, the ObjectConfiguration.NormalizeDataSet static method has been extended to explicitly mark columns as writable. AbsractObject.ExecuteDataSetAsync calls NormalizeDataSet before returning a data set, effectively making the result backward compatible with ExecuteDataSet.

Setting DataColumn.ReadOnly = false is now the default behavior; this can be feature-switched with the application setting qbo.Application.Properties.Settings.Default.DataSetColumnsWritable (default is true).
Comments