Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

Specifying the threading model of a .NET class

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Juan Dent - 03 Aug 2005 01:12 GMT
Hi,

Looking with OLE COM VIEWER at some .NET classes that were also registered
for COM, I found something surprising:

     even though I can't find any differences in the attributes applied to
them,
    some appear as Apartment and others as Both. Funny thing is all that
appear
     as Apartment belong to the same assembly and all that appear as Both
belong
    to another assembly, as if some setting at the level of the assembly was
    involved.

Any ideas here?
Signature

Thanks in advance,

Juan Dent, M.Sc.

"Peter Huang" [MSFT] - 03 Aug 2005 03:47 GMT
Hi

I think this is concern about how the .NET class is implemented and how to
use.
Usually, a class can be loaded into MTA needs to implement more synchronize
code in multiple thread scenario.

Here are some links about MTAThreadAttribute and STAThreadAttribute
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemstathreadattributeclasstopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemMTAThreadAttributeClassTopic.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Willy Denoyette [MVP] - 03 Aug 2005 19:54 GMT
> Hi,
>
[quoted text clipped - 12 lines]
>
> Any ideas here?

Not sure what .NET classes you are looking at but they all should be both.
Mind to tell us which class is 'apartment' ?

Willy.
Juan Dent - 03 Aug 2005 21:28 GMT
Thank you again Peter!
Thanks Willy.

Actually, I am migrating a COM C++ system to .NET, and some of the classes
still exist in COM. And, as pointed out by Willy, I have come to realize that
all .NET classes indeed appear as BOTH. Only the older COM classes appear as
APARTMENT.

Sorry, didn't catch that. At least now I know that ALL classes created using
.NET MUST appear as BOTH, is that correct Willy?

Signature

Thanks in advance,

Juan Dent, M.Sc.

> > Hi,
> >
[quoted text clipped - 17 lines]
>
> Willy.
Willy Denoyette [MVP] - 03 Aug 2005 21:53 GMT
> Thank you again Peter!
> Thanks Willy.
[quoted text clipped - 9 lines]
> using
> .NET MUST appear as BOTH, is that correct Willy?

Yep, note that this is only important when you consume these 'COM' objects
from native COM clients, managed clienst don't know anything about
apartments.

Willy.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.