What you are describing is, to be honest, absolutely incorrect and is completely against the way CSLA is designed to work.
You should read Chapters 1-5 of Expert 2008 Business Objects, and probably chapters 17-18 as well. They will help you understand how to use the framework effectively.
Or get the Core 3.8 video series, as it also walks through exactly how to implement this sort of object model.
CSLA is designed to have a single "root" object that is retrieved/saved through the data portal. Child objects contained in that root object flow through the data portal along with that root object. In your example, you should make exactly 2 calls to the data portal - one to retrieve the object graph, one to save the object graph.
How you talk to your database is a different matter. There are many technologies in .NET to talk to the database (ADO.NET, DataTable, Entity Framework, etc). In most cases, when doing insert/update/delete operations each object will talk to the database on its own - but this is often occurring from an application server sitting in the same data center as the database server, so performance is not a big issue.
Also consider that most app architectures follow this model of having a separate SQL call per object/entity/row/whatever. CSLA is far from unique in supporting this model - and CSLA certainly doesn't require this model. If you'd rather do a batch SQL update, and then reconcile the results you get back from the SQL insert/update/delete operations to update your object graph, then you can certainly do that - but it is a lot of work, which is why it is rarely done (in CSLA or elsewhere).
Well think about a list of child items. You could implement the list's data access code to loop through and find all changed child items. Using that information you could create one large SQL command, with a SQL INSERT/UPDATE/DELETE for each changed row - all concatinated into this one SQL command. And you could execute that command - thus making one database call to do all the changes.
That's not too hard.
But now suppose that the INSERT items generate new unique key values. And suppose the INSERT/UPDATE items generate new timestamp values. How do you get all those values back? And when you get them back, how do you find the appropriate objects in your list so you can update the objects with the new id/timestamp values?
This can be done, but it is not too easy.
CSLA doesn't do your data access, and so you can choose either implementation.
Most people have each object save itself to the database because that is a LOT easier.
Regarding the book and videos, the Expert 2008 Business Objects book is half about how to use CSLA and half about how CSLA itself is implemented. The video series is 100% about how to use CSLA. The book is about version 3.6, and the videos are about 3.8, so the videos are more current than the book.
Both are valuable. Some people learn better by reading, others by listening or watching.
st3fanus:
Hi Rock..
I forgot to ask you about : How much the video series ..?
Copyright (c) Marimer LLC