I have a reporting-based website using
OrmLite, using a SQL Server back-end. Due to the duration of some of the reports, I'd like to either globally, or selectively (via
Service-derived class or some attribute) make queries that run reports have a longer
CommandTimeout. I'd like to keep using the existing code to query data for the reports (
Db.SqlList calls), so I won't have to write boiler-plate code in each reporting class & method.
I've tried using the
AlwaysUseCommand, but that requires declaring a single command that has an open connection. I don't see how I can do that without opening the connection in my
AppHost.Configure method and never closing it. It'd be nicer if it were a function pointer, but alas.
I've also looked at overriding the
Db property of
Service, but that just returns an open
IDbConnection without letting me override command created.
It seems like my last option is to create a custom
DbConnection class, like the MiniProfiler's ProfiledDbConnection, but I'd have to implement a dozen abstract methods. It seems like overkill in order to set one property on a DbCommand.
ServiceStack.OrmLite, how do I globally modify the
DbCommands that are created?