Thread-safe objects?

Thread-safe objects?

Post by Michael Giagnocav » Thu, 25 Oct 2001 03:24:12



Hello,

    How can I know if an object or control provided by the .NET Framework is
thread-safe?

For instance:
        I'd like to share a loaded CryptoProvider for all my site, loaded in
a VB Module at startup.
        I'd also like to do the same for a ResourceManager for an entire
site.

    Is this ok?  Where would I find this information in the future, for
other objects?

Thanks,
-Mike

 
 
 

Thread-safe objects?

Post by Patrick Steel » Sat, 27 Oct 2001 01:12:55




Quote:> How can I know if an object or control provided by the .NET Framework is
> thread-safe?

Try the "IsSynchronized" property.  I've seen it in a lot of classes.

--
Patrick Steele
Microsoft .NET MVP

 
 
 

1. Thread-Safe Data Access Layer

I've posted a thread in the last page of this newsgroup
which explains my situation in a bit more detail.  

I'm trying to design a thread-safe DataLayer.  The reason
it needs to be thread safe is because I keep my
DataAdapter and DataCommand objects as member variables
to each Data Module class ( i.e. EmployeesModule, or
Customers Module ).  I only have one DataAdapter per
Module.

So, I want exlusive access to a DataCommand's parameters
collection, and a DataAdapter's SelectCommand every time
an associated method is called.  The last comment
suggested that I lock the Connection for each associated
DataCommand.

I was trying to reduce the overhead of creating
DataAdapters and DataCommands every time a ( say,
EmployeesModule.GetEmployeeData(...) ) method is called.  
Am I wasting my time?  Is there a better design out there?

I just want a simple, thread-safe Data Access Layer in
ADO.NET.  Any ideas?

B

2. cisco 2600 ip addresses

3. Thread-safe ADO.NET SQLCLIENT access in a httphandler

4. Re : Econet E01 Date problems

5. thread-safe merge?

6. optical mouse problem

7. copying files thread-safe

8. Windows machines don't see unix machine which can see them

9. Safe threading by delivering EVENTS to UI THREAD

10. XPathExpression thread-safe?

11. Is XPathNavigator.Evaluate thread-safe?

12. Having trouble making thread-safe Event calls

13. Trace class not thread-safe?