I'm new in OOP and still I have datacentric thought.
I have a question about update methods on CSLA
Is Normal do things like
Partial Class Bill
(…)
Sub DataPortal_Update()
(...)
Dim vM as StockMovement
vM = StockMovement.CreateStockMovement
(….)
vM= vM.Save
(…)
Using the same transaction scope or sharing conection and transaction?
Or this should be done at store procedure that updates the bill object?
What pattern do you use to solve things like this?
I think it is OK to handle other activities within the DataPortal. Especially if they require the same transaction scope. Rcoky has recommended the creation of a special command object to control all of the other objects and set up a single transaction. I use the same idea with a normal root BO which is a Use Case Controller. This allows me to also have high level rules within the controller BO. This object also controls the entire Save activity.
Joe
The idea is to share transaction connection between diferent objects, perhaps with LocalContext or other own way.
I will generate objects that will be called inside dataportal methods (or not).
What problems could find using this technique?
DataPortal_update()
GetActiveTransaction
BeginTransaction...
Try
Some new objects ussage with Save and delete methods (dataportal Calls)
That will use the same transaction
catch
Rollback
throw exception
end
commit
End
I will use manual transactions because I have to work with SQL 7.
Thta is almost exactly the same technique I use.
If you search this forum you may find all the support code I shared about a year ago.
I added some code to BusinessBase so that it would be easier to share the transaction.
Joe
Thanks for your support
Can you give me some keys to find these posts, I'm very interested.
I searched on BeginTransaction and found this:
http://forums.lhotka.net/forums/thread/9066.aspx
Be sure to search for Rocky's CommandBase solution so you can look at it in a different way too.
Joe
Copyright (c) Marimer LLC