79836795

Date: 2025-12-03 11:09:44
Score: 1
Natty:
Report link

The old code stores the open connection for the duration of the request. I wanted to fix this by not opening it manually, and let Dapper open and close it as needed. I believe that when a connection is closed, it is released back to the connection pool. That way a request would use a single connection, but opening and closing it as needed.

In your example, Dapper is opening and closing the connection, but with no retry policy, if a minor glitch causes the Open to fail, the entire request will fail.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: stefan