Can I use connection pooling with SQLDatasource?

2019-08-29 12:57发布

问题:

After reading documentation about Connection Pooling, I learned that ADO.NET uses Connection pooling by default. But the application that I am working with using SQLDatasource and I wonder if I can use Connection Pooling?

If yes, is there a quick tutorial around?

回答1:

My guess would be that it uses System.Data.SqlClient in turn so that as long as you use the same connection string, pooling will work.

I think you can test it quite easily though. Just spawn up a bunch of these from code and attach the sql profiler and see if you get alot of calls to "sp_reset_connection" which gets called every time a connection is pulled from the pool.