New DbException in .NET 2.0...
There was some talk at work the other day about using Enterprise Library, specifically the Data Access stuff that enabled database agnostic code. There is an issue with this in .NET 1.0 and 1.1 in that not all of the database .NET Types support this capability. Here is an excerpt of my response:
My point was more targeted at the SqlException versus the OracleException type, more specifically where you want to use the likes of the database error code to perform some sort of conditional business logic. The SqlCommand and SqlDataReader et al, implement the likes of IDbCommand and IDataReader so these can be cast back and generic database agnostic code created – great. The likes of SqlException and OracleException inherit from Exception so you are sort of stuffed from that perspective, there is no consistent means to access this database information other that sticking to the known type – not so great.
There is however a happy ending to this story, this has been cleaned up in .NET 2.0. The SqlException and OracleException now both inherit from DbException so this will be possible in the future.
0 Comments:
Post a Comment
<< Home