From: Lee C. <lee...@ad...> - 2003-07-27 16:38:14
|
Hi, I wanted to know if i should create a db access class as static or not = when designing a multi-threaded application. I am going to have = multiple threads wanting to use this class to access firebird. My = question is if i created a static class and all these threads accessed = the method for executing a query do I have to worry about thread = synchronization as long as whatever I do withini this method doesn't = access something that may be being used in another thread? Imagine I = had code similar to this: public static sealed class DBAccess { public DBAccess(string connectionString) { } public static int ExecuteNonQuery(string query) { FbConnection conn =3D new FbConnection(connectionString); conn.Open(); FbCommand cmd =3D new FbCommand(query, conn); return cmd.ExecuteNonQuery(); } } Would I safely be able to call that static method from multiple threads? |