Red
Sun May 16 08:05:12 CDT 2004
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.
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:tof8a0dsau59g6lm8ckj5ndb5sead3cl2e@4ax.com...
> 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,
>
> --
> Scott
>
http://www.OdeToCode.com
>
> On Fri, 14 May 2004 11:06:46 +0800, "Red Forks" <redforks@hotmail.com>
> wrote:
>
> >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!
> >
>