Distributed Transactions with .NET remoting

Distributed Transactions with .NET remoting

Old forum URL: forums.lhotka.net/forums/t/11747.aspx

walkerjgt posted on Thursday, December 13, 2012

We are trying to wrap multiple database updates in a transaction inside of a CSLA CommandBase execute method. It appears we run into a problem when the transactions get promoted to MSDTC.
Csla.DataPortalException: DataPortal.Update failed () ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Could my issue be with the way I registered the CSLA.DLL with COM+? 

I added the following to my web config -
<wellknown mode="SingleCall" objectUri="ServicedDataPortal.rem" type="Csla.Server.ServicedDataPortal, Csla"/>
CSLA 3.0.5
dumbed down version below of DataPortal_Execute()




Transactional(TransactionalTypes.EnterpriseServices)> _





Overrides Sub DataPortal_Execute()
Using scope As New TransactionScope()  


_NewRider = CreateRider()

dothis(_NewRider) 'uses dataportal to access database

dothat(_NewRider) 'uses dataportal to access database

dosomethingelse(_NewRider) 'uses dataportal to access database


End Using

End Sub



RockfordLhotka replied on Friday, December 14, 2012

It might be that you can't mix enterprise services and transactionscope transactions.

When you mark your DataPortal_XYZ method as Transactional(EnterpriseServices) the data portal routes your call through a COM+ component that requires a COM+ transaction. So by the time your DataPortal_XYZ method is invoked, you are already inside an active COM+ transaction using the DTC.

I've never tried creating a TransactionScope object _inside_ an existing COM+ transaction, and rather suspect it isn't a valid scenario.

Copyright (c) Marimer LLC