SqlConnection with ThreadStatic attribute RRS feed

  • General discussion

  • Lately I've worked with project where SQL Server is used and I have to use existing old data access code. First data access code base is partly based on .NET 1.x. Creator have been using one class full of static methods that begin transaction, execute insert, updates, deletes and stuff like that and in that class there is a static variable type of an SqlConnection that this class uses in every method it has to access database server and the variable has been decorated with ThreadStatic attribute. Third application is build on ASP.NET so multithreading is fact.

    Now I'd like to know, just to raise my knowledge, how this might affect in use of an connection? Mainly I want to know how it affects performance and possibly connection pooling. I tried to find same information from elsewhere, but haven't found any short, really informative documentation about the subject.

    Monday, February 1, 2010 1:25 PM