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. Dapper will indeed throw SqlException when used against a SqlConnection.
splitOn: CustomerId will result in a null customer name. If you specify CustomerId,CustomerName as split points, dapper assumes you are trying to split up the result set into 3 objects. First starts at the beginning, second starts at CustomerId , third at CustomerName . Follow this answer to receive notifications.
Dapper is a micro ORM or it is a simple object mapper framework which helps to map the native query output to a domain class or a C# class. It is a high performance data access system built by StackOverflow team and released as open source.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With