I had the same problem recently and did a bit of investigation, going so
far as buying and reading a whole textbook "Transactional COM+" by Tim
Ewald. He has several sections on raw configured components ie.
configured components that run in the callers context. However when I
tried what he suggested I got the same problem as you - a new context
for every object. I then happened to go and check out latest comments on
the book by the author and came across this
(http://www.develop.com/books/txcom/technotes.htm):
****************************************************
Raw-Configured Classes and Windows 2000 Service Pack 1
On Windows 2000, an instance of a raw-configured class can be
instantiated in the default context of an apartment as long as its
threading model is compatible. This is a bug and has been fixed in
Windows 2000 Service Pack 1. Under SP1, instances of a raw-configured
class can never be instantiated in the default context of an apartment.
They are always put into new contexts instead. 

This behavior is necessary to support the use of the Shared Property
Manager (SPM). The SPM supports locking a group while a method is in
process. If an object acquires a reference to a SPM group and stores it
in a data member, the SPM will automatically lock the group before a
method call starts and unlock the group after a method call ends (unless
the object releases its reference to the group in which case it is
unlocked immediately). For this to work, an object has to be in a
context configured to support the SPM, which an apartment's default
context is not (attempts to use the SPM from an apartments' default
context generate an exception). Since any configured class can use the
SPM, SP1 forces all instances of configured classes, even raw-configured
classes, to live in contexts that support the SPM. 

The discussion of default contexts on pages 124-126 in Chapter 4 is
correct for Windows 2000, pre-SP1. With SP1, an instance of a
raw-configured class is never instantiated in an apartment's default
context. 
****************************************************
I have reached the point where I suspect that raw configured classes are
not possible??
------------------------------------------------
 
Tarquin Vaughan-Scott
Web Development
Woolworths
ph: 407 3264
cell: 082 8242474
 


> -----Original Message-----
> From: JC Oberholzer [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 15, 2003 3:48 PM
> To: [EMAIL PROTECTED]
> Subject: [ADVANCED-DOTNET] COM+ Context Question
> 
> 
> Hi All
> 
> I'm developing COM+ components in VB.NET and have a fair bit 
> of experience with COM+.  I cannot solve the following 
> however: Each one of my components activates in their own 
> context.  As far as I understand, this has a fair bit of 
> overhead, and want to get them to activate in the same 
> context as far as possible.
> 
> Nearly all objects are declared as follows:
> 
> <Transaction(TransactionOption.Required)> _
> Public Class clsClient .....
> 
> I do not set any other attributes, as I do not use role based 
> security etc.  Wheter I run it as library or server package 
> does not make a difference.  The property I examine to check 
> wheter they run in the same context is : ContextUtil.ContextId
> 
> Now, as far as I understand, COM+ checks wheter they can live 
> in the same context, and if so, it creates them in the same 
> context.  However, my objects do not active in the same 
> context, even if I try and force it using the Must active in 
> callers context, which return an activation error.
> 
> When I make the child components non configured, they then 
> activate in the callers context, which gives a huge speed 
> improvement, and this is what I am looking for.
> 
> Any ideas as to what properties might influence why it is 
> created in seperate contexts?
> 
> Thanks
> JC Oberholzer
> 
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com 
> NEW! ASP.NET courses you may be interested in:
> 
> 2 Days of ASP.NET, 29 Sept 2003, in Redmond 
> http://www.develop.com/courses/2daspdotnet
> 
> Guerrilla 
> ASP.NET, 13 Oct 2003, in Boston 
> http://www.develop.com/courses/gaspdotnet
> 
> View archives and 
> manage your subscription(s) at http://discuss.develop.com
> 
Please note: This e-mail and its contents are subject to a disclaimer 
which can be viewed at http://www.woolworths.co.za/disclaimer. Should
you be unable to access the link please e-mail [EMAIL PROTECTED] 
and a copy of the disclaimer will be e-mailed to you.

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to