Using COM+ through EnterpriseServices

G

Guest

Hi,

I am looking for the equivalent of TransactionContext object from COM+ from
..NET using EnterpriseServices, since COMSVCS.dll does not provide a primary
interop assembly (thus it is not strong name and cannot be used from strong
named assemblies). I need this because I want to do the following:

"I need to open a COM+ transaction inside an assembly, keep it open even as
a thread leaves the assembly and later either abort or commit the
transaction. Clearly this cannot be done by using the transaction attribute
since the vote is cast upon method return. I had hoped that using an
EnterpriseServices.Activity I could keep a transaction open, but it does not
seem that way."


Also, note that according to Peter Huang, COMSVCS.dll is not accompanied by
a PIA because Microsoft has placed all its functionality within the reach of
the EnterpriseServices namespace.
 
D

Daryl

Hi Juan,

Check out CRMs Resource Managers as I think you can enlist in a transaction
then commit when you are ready.
Haven't tried it but came accross it looking for something else.

Hope this helps
Daryl
 
G

Guest

No. I need the exact equivalent of what was the ITransactionContext in COM+
but withing the Enterprise Services.

I need to:

1) be able to create several transaction contexts on the same thread, and
begin a transaction on each of them, storing the contexts for use when:
2) there is a need to create an object within one of these contexts
3) there is a need to commit one of these transactional contexts
4) there is a need to abort one of these transactional contexts

--
Thanks in advance,

Juan Dent, M.Sc.


Daryl said:
Hi Juan,

Check out CRMs Resource Managers as I think you can enlist in a transaction
then commit when you are ready.
Haven't tried it but came accross it looking for something else.

Hope this helps
Daryl
 
P

Peter Huang [MSFT]

Hi

I think in .NET, we use the attribute to control the transaction creation.

TransactionAttribute Members
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystementerpriseservicestransactionattributememberstopic.asp

We use the TransactionOption as below to control whether the component will
be in a transaction.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystementerpriseservicestransactionoptionclasstopic.asp

Disabled Ignores any transaction in the current context.
NotSupported Creates the component in a context with no governing
transaction.
Required Shares a transaction, if one exists, and creates a new
transaction, if necessary.
RequiresNew Creates the component with a new transaction, regardless of the
state of the current context.
Supported Shares a transaction, if one exists.

e.g. If A is RequiresNew, B is Supported/Required, and you now create B in
A, then A and B will be in the same transation.


Best regards,

Peter Huang
Microsoft Online Partner Support

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

Guest

I am aware of the use of attributes. However transactions are controlled
automatically for serviced components (COM+ components) and that is not what
I need.

As I stated in my last posting, I rather need a behavior much more identical
to the old ITransactionContext. Let me show a code snippet to clarify:

--------
public void BeginTrans(int DBType )
{
ITransactionContext tranContext = new TransactionContextClass();
// store the intiated transaction according to DBType, until commit or
rollback are
// called
this.contextMap[ DBType ] = tranContext;
}
public void CommitTrans(int DBType)
{
// get appropiate transaction context on which to commit
ITransactionContext tranContext = this.contextMap[ DBType ];
tranContext.Commit();
}
public object CreateInstanceEx( string progId, int DBType )
{
ITransactionContext tranContext = this.contextMap[ DBType ];
return tranContext.CreateInstance( progId );
}
 
P

Peter Huang [MSFT]

Hi

So far I am researching the issue, and I will update you with new
information ASAP.

Best regards,

Peter Huang
Microsoft Online Partner Support

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

Peter Huang [MSFT]

Hi

I think so far the Enterprise namespace have not covered all of the COM+
API.
We will improve in the next version, you may look at the
System.Transactions namespace in .NET 2.0:
http://msdn2.microsoft.com/library/a90c30fy(en-us,vs.80).aspx

I know it is beta still, but by waiting a few months and taking a
dependency on 2.0 you will avoid a lot of work.

Alternatively, you may try to look at "Services without components"
http://www.15seconds.com/issue/030930.htm

So far I would not recommend trying to interop to COMSVCS via PIA, because
it is not supported.

Best regards,

Peter Huang
Microsoft Online Partner Support

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top