title: Distinguishing between different errors raised by System.Data.SqlClient.SqlException
body: <p>There are no error codes that one can check on System.Data.SqlClient.SqlException. I want to map some of these exceptions into application specific exceptions, but I dont want to parse the error message itself (for known reasons). For example, when a method attempts to remove an object, I want it to distinguish whether the operation failed because the requested object does not exist in the database or because the foreign key constraint was violated. Any ideas on elegant ways of accomplishing this?</p>