I'm using dapper.net and I've wrapped connection.Execute
for my Delete
and Update
statements.
public virtual void Update(TEntity entity)
{
IDbConnection connection = connectionService.Connection;
connection.Execute(UpdateQuery, entity, connectionService.Transaction);
}
When I've come to use this, I want to know if it fails or not by catching an exception(s) and not just a general Exception
. Which (if any) exceptions are thrown? I would assume SqlException
, but a previous manager taught me to assume nothing.
Can anybody point me in the right direction as to where I find this information?
Dapper will indeed throw SqlException
when used against a SqlConnection.
The exceptions will be consistent with those that you will get from vanilla ADO.NET code. With a value that is the code of the specific SQL exception type.