Synchronized Attribute on COM+ Pooled App Needed?

  • Thread starter Thread starter localhost
  • Start date Start date
L

localhost

I have a class that inherits from System.EnterpriseServices, instances
exist in a COM+ object pool (Win2K COM+ Server Application). There is
one primary method in the class for connection to various database
sources.

Will I get any benefit by adding these attributes to the data-getting
method:

[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.Synchronized)]

Thanks.
 
Hello,

Thanks for your post. As I understand, you want to know the relationship
between CompilerServices and COM+. I'd like to share the following
information with you:

1. COM+ has its own synchronization mechanism, such as activity, etc.
Please refer to the MSDN article and code snippet below. Applying
MethodImplOptions.Synchronized is not the same thing. You may want to use
MethodImplOptions.Synchronized when you manages the threads and
synchronizations in your own application, which is not configured in COM+.

//--------------code snippet-------------------
[Synchronization]
public class TestSync : ServicedComponent
//------------------end of-----------------------

Synchronization
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconsynchronizationactivity.asp

2. MethodImplOptions.NoInlining is a performance flag. Use of this
attribute depends on actual code, which is introduced in the following
article:

Writing Faster Managed Code: Know What Things Cost
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/fastmanagedcode.asp

You may use this attribute according to the actual situation.

Does this answer your question? I am standing by for your feedback.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top