Shared Connection

Shared Connection

Old forum URL:

dmnc posted on Tuesday, January 25, 2011

I am implementing an export scenario to dump product data from SQL server to SQL Server Compact Edition. A local temporary table is initialized with the product numbers to export. The product data is bulk fetched through a couple of stored procedures accessing the local temporary table to get only the data for the desired items.

For this to work, a shared connection has to be used as local temporary tables are visible only to the current connection. I could utilize Csla.Data.ConnectionManager to have a shared connection. Would this be thread-safe? Is there any catch?


RockfordLhotka replied on Tuesday, January 25, 2011

ADO.NET is not threadsafe, and neither is ConnectionManager.

ConnectionManager maintains a consistent connection on a single thread. It is designed to enable reuse of an open connection across one object graph in a single data portal call, not between mutliple clients or object graphs or data portal calls.

Copyright (c) Marimer LLC