Hello,
I'm currently developing a Windows Service that will serve as an application server. I'm using the Task Parallel Library to launch tasks in separate threads and most of these tasks are calls to stored procedures in a SQL Server database. My questions is two-tier:
I'm currently developing a Windows Service that will serve as an application server. I'm using the Task Parallel Library to launch tasks in separate threads and most of these tasks are calls to stored procedures in a SQL Server database. My questions is two-tier:
- What is the preferred connection method? Create a connection for each task or use the same connection with MultipleActiveResultSets=True?
- is MSSQL's SCOPE_IDENTITY() thread safe when multiple threads are using the same connection?