I have collection of switchable objects. This collection inherits from BusinessListBase.
I have this code for saving changes to the collection:
<Transactional(TransactionalTypes.TransactionScope)> _
Protected Overridable Overloads Sub DataPortal_Update() Me.Child_Update(Me) End SubNow, when I run this and make only 1 change to a single child object, an MSDTC transaction is created. If I stop the MSDTC service on my laptop, this action will fail with the error:
DataPortal.Update failed (Csla.DataPortalException: ChildDataPortal.Update failed on the server ---> Csla.Reflection.CallMethodException: Child_Update method call failed ---> System.Data.SqlClient.SqlException: MSDTC on server 'mylaptop' is unavailable.
I had thought that CSLA would not involve the transaction unless it was needed (i.e. more than 1 BO was changed in the list). Did I remember that wrong?
By using the Transactional attribute, am I forcing a transaction even though none is really required? I tried running my code w/o that attribute and transactions are never invoked even if I have many changes that are being saved.
Any help would be appreciated.
I'm afraid I still am not quite sure.
From what I can tell, there is only 1 time when I open a connection.... when I save the 1 child object that has changes. The first child object who's dataportal is called starts the transaction, so if that is the 2nd connection when is the first connection opened?
Thanks for sticking with me. I'll post some code below.
Also, I should note, it's possible that I have been using the wrong terms when calling these objects Child objects. Really, they are just switchable items that belong to a Collection/list.
So, lets say I have PlayersList, inherits BusinessListBase, containing a bunch of Player objects.
...............
I had put a bunch of code here, but I think in going over the code to copy, I found the issue.
Inside my function that does the "Save", I am using the MS data access blocks.
One of their lines is:
storedParams = SqlHelperParameterCache.GetSpParameterCollection(ConnectionString,
"Players_Search")I think that is hitting the database, thus, that is the first connection.
Later the actual save takes place... the 2nd connection.
I am going to test and report back.
Copyright (c) Marimer LLC