S
Stephen Carson
I'm trying to build a Web Service that will kick off threads as logging
requests come in. These threads will then log to the database. I have
been able to make a simple Web Service. I have been able to get a
simple multi-threaded example working. I have been used the
SqlDataAdapter and DataSet classes extensively to access databases in a
deployed Windows Service. But I'm getting confused how to put the
pieces together.
For example, I want to make the class that I'm going to hand off to the
thread able to access the database. The way I learned to do that is
with a Component Class:
__gc public class LogItem : public System::ComponentModel::Component
But in the docs, I note this:
"Any public static (Shared in Visual Basic) members of this type are
safe for multithreaded operations. Any instance members are not
guaranteed to be thread safe."
But that makes the Component Class pretty darn useless for my purpose.
How do I do thread safe database access?
If anyone has seen an example of a multi-threaded Web Service talking
to a DB, please let me know. It seems like a fairly obvious thing to do
with a Web Service.
Thanks,
Stephen W. Carson
requests come in. These threads will then log to the database. I have
been able to make a simple Web Service. I have been able to get a
simple multi-threaded example working. I have been used the
SqlDataAdapter and DataSet classes extensively to access databases in a
deployed Windows Service. But I'm getting confused how to put the
pieces together.
For example, I want to make the class that I'm going to hand off to the
thread able to access the database. The way I learned to do that is
with a Component Class:
__gc public class LogItem : public System::ComponentModel::Component
But in the docs, I note this:
"Any public static (Shared in Visual Basic) members of this type are
safe for multithreaded operations. Any instance members are not
guaranteed to be thread safe."
But that makes the Component Class pretty darn useless for my purpose.
How do I do thread safe database access?
If anyone has seen an example of a multi-threaded Web Service talking
to a DB, please let me know. It seems like a fairly obvious thing to do
with a Web Service.
Thanks,
Stephen W. Carson