hotmail wrote:
Hello
Is there an option to require passing adapter in every RetrievalProcedures/ActionProcedures by default?
The main issue is that without specifying the DataAdapter instance the use the system would have to create a new one each time, so you would have no control over the transaction or connection it was using, unless you created a single static DataAdapter that was shared by all calls (and that's not a good idea).
If you're using IOC and you have control over the scope of a call, you could have a per-request or per-instance adapter injected into every class, but overall it's much safer and wiser to track and understand the adapters used.
If you want to call lots of SPs within a short space of time and (for some odd reason) don't want to pass the adapter in, create an IDisposable class that takes the adapter as a constructor, and write your call methods on that class, each calling the appropriate stored proc using the stored data adapter value. This is essentially a repository pattern.
I'd recommend you forget about saving a few characters on each call and pass in the DataAdapter as required.
Cheers,
Jason