[Mono-devel-list] Re: Review of system.data - ISafeDataRecord

Konstantin Triger kostat at mainsoft.com
Wed May 4 14:05:25 EDT 2005

Hello all,

The MS behavior requires
1. IDataReader.GetXXX - type specific to throw an exception if the wrong 
method is called, even if the types are convertable.
2. When filling the DataTable with Fill opeartion and convertable types 
are seen, the conversion should be "quiet".

Tests show that MS implementation always calls GetValue and then 
probable makes the needed conversion.
In order to eliminate call the GetValue call, I would like to introduce 
the ISafeDataRecord interface, which will try to Convert if an incorrect 
GetXXX is called.

In the NET_2_0 effort, we may have this interface implemented by 
DbDataReader, so each GetSafeXXX method will call GetFieldType() and if 
the types are equal will proceed with its GetXXX. Otherwise it can 
GetValue and ConvertTo or even something cheaper. Certainly, every 
provider implementer may override any of the GetSafeXXX methods and 
provide something better. But even if not, this will be a good saving.

What do you think?

Konstantin Triger

More information about the Mono-devel-list mailing list