MSDTC on server XYZ unavailable when deleting - solved

MSDTC on server XYZ unavailable when deleting - solved

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


stefan posted on Thursday, August 07, 2008

Hi,

I recently encountered the well known 'MSDTC on server unavailable' message problem
while I was trying to delete an object from within the objects edit form (-> DataPortal_DeleteSelf ).
I was using the ConnectionManager pattern, so at first I was stumbled...

I found out that removing the Transactional attribute from the DataPortal_DeleteSelf override
solved the issue. Having the Transactional attribute on both DataPortal_DeleteSelf and 
DataPortal_Delete resulted in two nested transactions, which obviously required MSDTC,
even with just one connection opened at a time...

 ' <Transactional(TransactionalTypes.TransactionScope)> _
  Protected Overrides Sub DataPortal_DeleteSelf()

    DataPortal_Delete(New SingleCriteria(Of Project, Guid)(ReadProperty(Of Guid)(IdProperty)))

  End Sub

  <Transactional(TransactionalTypes.TransactionScope)> _
  Private Overloads Sub DataPortal_Delete(ByVal criteria As SingleCriteria(Of Project, Guid))

    Using ctx = ContextManager(Of ProjectTracker.DalLinq.PTrackerDataContext).GetManager(ProjectTracker.DalLinq.Database.PTracker)
      ' delete project data
    ...
    End Using

  End Sub

So when you are just delegating to DataPortal_Delete, the attribute there seems sufficient, IMHO.
Maybe Project Tracker is following a wrong pattern here?

Stefan

Copyright (c) Marimer LLC