Does anybody use Data Access Application Block in Asp.Net?

  • Thread starter Thread starter Red Forks
  • Start date Start date
R

Red Forks

I found "Data Access Application Block" has a feature of caching
sqlparameters. I'm doubt that feature can use under multi-thread environment
such as Asp.Net. Maybe one SqlParameter instance is using by
SqlCommand.ExecuteXXX(), while another SqlCommand attempt to use the
SqlParameter instance again!
 
The caching class uses a synchronized Hashtable object for keeping the
parameters, and when you ask the class for a set of parameters, the
class returns a deep copy of the parameter array (to avoid sharing
parameters across connections). These two practices allow the DAAB to
work safely in a multithreaded app.

HTH,
 
Oh£¬I found the method:
private static SqlParameter[] CloneParameters(SqlParameter[]
originalParameters)
.. Yes! it works.
It's 1st time I see that SqlParameter support IClonable interface. Thanks!

Clone it or recreate it, I think the cost is just the same (except for
procedure parameters). So caching is more concerned on convince than
performance.
 
Back
Top