No, TransactionScope is designed for a single database. The challenge is that it is only fast if you only open exactly one database connection and reuse that connection.
This is the purpose of Csla.Data.ContextManager - to make it very easy to reuse a single connection - thus making TransactionScope the right option.
ContextManager opens a connection if it isn't open, or reuses a connection if it is already open. The trick is to nest all your Using blocks.
In other words, the root object (where your DP_XYZ method is called by the data portal) should have a Using block for the context, and all related data access should be in that Using block.
<Transactional(TransactionScope)> _
Protected Overrides Sub DataPortal_Update()
Using ctx = ContextManager(Of MyDbContext).GetManager("MyDbName")
' update this object
' update child objects
' interact with any other root or command objects
End Using
End Sub
As long as everything happens within that Using block, all the Using blocks in those other objects will automatically reuse the same L2S data context object, and thus will reuse the same database connection.
As long as every root object's DP_XYZ methods follow this pattern, you can freely invoke one root object from another one's DP_XYZ methods and they'll all automatically reuse the data context.
The result is very clean and simple. No muss, no fuss ![Smile [:)]](/emoticons/emotion-1.gif)
Rocky