Is re-using a Command and Connection object in ado.net a legitimate way of reducing new object creat
- by Neil Trodden
The current way our application is written, involves creating a new connection and command object in every method that access our sqlite db. Considering we need it to run on a WM5 device, that is leading to hideous performance.
Our plan is to use just one connection object per-thread but it's also occurred to us to use one global command object per-thread too. The benefit of this is it reduces the overhead on the garbage collector created by instantiating objects all over the place.
I can't find any advice against doing this but wondered if anyone can answer definitively if this is a good or bad thing to do, and why?