ADO.NET rant

Why is SqlDbType in the System.Data namespace when all the other provider specific types are in their own specific provider namespace? There is definitely some ugliness going on here. I'm not sure it's entirely a mistake.

As an aside, why is it SqlDbType and not SqlType? I can understand why OleDbType is named the way it is, but OracleType and OdbcType seemed to be named appropriately. Maybe it has something to do with the fact there is a System.Data.SqlTypes namespace and that would be just too close for comfort in the naming. Ok, so why isn't there an OdbcTypes namespace or any other types namespace for that matter? And shouldn't System.Data.SqlTypes be under System.Data.SqlClient.SqlTypes?

So what's the deal with IDataParameter and it's descendent IDbDataParameter? All of the typed provider parameter implementations implement both of these. Shouldn't they be collapsed into one? Even the IDbCommand.CreateParameter method has to return a IDbDataParameter. Furthermore, the online help for IDbDataParameter says it includes stuff for mapping to dataset columns. That's odd because the only 3 members of IDbDataParameter are Precision, Scale and Size. I'm pretty sure none of those having anything to do with Datasets. In fact, it's IDataParameter that provides this mapping in the SourceColumn member. Sheesh

Talk about your inconsistencies. It's still in WinFx from what I can tell. Please someone tell me there is a reason for this madness.

 

Comments

  • TrackBack March 10, 2004 1:43 AM

    You've been Taken Out! Thanks for the good post.

  • Barry Gervin March 10, 2004 8:22 PM

    SqlDbType is in System.Data because System.Data.IDataReader uses it. I agree that it is named poorly and is too sql server specific.

    I'm not so up on the rest of the interfaces though. I know they weren't originally design for abstraction of data providers. They were designed for UI binding in visual studio designers. I'm sure the common 'shared' code for data adapters uses these interfaces when filling up a dataset from after the execution of some command object.

  • Barry Gervin March 11, 2004 10:24 AM

    What makes you think System.IDataReader uses it? IDataReader is simply an interface without any implementation and there is nothing in the interface that returns or accetps a SqlDbType.

New Comments to this post are disabled