Thursday, June 2, 2016

Design guidelines for concurrent DB connection in SOA

In a Service Oriented Architecture, our web services will be accessed by multiple users concurrently.

Some design guidelines that is useful while designing DB Access Layer for SOA architecture .

1. Don't make your connection static/shared.
2.Always use using statement for DB connection object. Using will act as try catch finally block and closes and disposes the connection object, and this connection object is moved to connection pool that is manged by CLR.
3. If you want to test concurrency in your application, create multiple threads and make multiple request to the exposed services.

 ServiceClientClass client = new ServiceClientClass ();  
 Thread th = new Thread(() => client.CallDBService());  

or as in this link:

If the connection object is reused by all requests, you will get unexpected errors like
 'Not allowed to change the 'ConnectionString' property. The connection's current state is open.'

Read more here:



Post a Comment