DataPortal_DeleteSelf not being called in remote data portal

DataPortal_DeleteSelf not being called in remote data portal

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


CBoland posted on Tuesday, March 23, 2010

I'm using CSLA 2.1.4 and working an issue where DP_DeleteSelf is called when data portal is local, but not remote. My object is a root class (not a child). I'm executing unit tests in the context of MSTest. This is what my test is doing:

  1. Create a new Widget object (myWidget).
  2. Save the Widget. (myWidget.Save() )
  3. Delete the Widget (myWidget.Delete(), then myWidget.Save() )
  4. Check that myWidget no longer exists in database.

Step 4 is failing because the object still exists. The problem that I can see is that DataPortal_DeleteSelf is not being called when the data portal is remote (hosted in IIS), although it does get called when the data portal is local. Everything else seems to be working correctly in both cases.

Stepping through the final myWidget.Save() in Step 3 and into the CSLA code, I can see a MethodInfo for "DataPortal_DeleteSelf" prepared and called from the client side in RemotingProxy.Update(), which in turn calls Portal.Update(), but Widget.DataPortal_DeleteSelf doesn't get called on the remote side. On the client side, after the call is made, no exception is apparent, and a resulting Widget object is deserialized (not sure where this instance comes from).

Since Widget.DataPortal_Insert and Widget.DataPortal_Update are called as expected, I thought there may be a problem with the declaration of Widget.DataPortal_DeleteSelf, but it looks comparable to the other DP methods:

        <Transactional(TransactionalTypes.TransactionScope)> _
        Protected Overrides Sub DataPortal_DeleteSelf()
            DataPortal_Delete(New CriteriaDelete(Me.ID))
        End Sub

        <Transactional(TransactionalTypes.TransactionScope)> _
        Private Overloads Sub DataPortal_Delete(ByVal criteria As CriteriaDelete)
            ...
        End Sub

        <Transactional(TransactionalTypes.TransactionScope)> _
        Protected Overrides Sub DataPortal_Insert()
            ...
        End Sub

        <Transactional(TransactionalTypes.TransactionScope)> _
        Protected Overrides Sub DataPortal_Update()
            ...
        End Sub

Again, this all works correctly when the data portal is local, but when data portal is remote, DataPortal_DeleteSelf isn't called.

Can anyone offer a suggestion of what to look at next?

Copyright (c) Marimer LLC