I have an ASP.NET Core 5 MVC project which uses Dapper. I have around 100 repositories in which Dapper is used. I want to set a command timeout now, one way is specifying individually on every Dapper query like this:
commandTimeout: TimeoutInSeconds
But that's very time consuming and not a good practice.
Is there anyway we can set command timeout globally in Dapper?
Just set it globally in dapper (just call it at the very beggining of your app):
Dapper.SqlMapper.Settings.CommandTimeout = 100;