BusinessListBase with root object

BusinessListBase with root object

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


Bruce posted on Thursday, May 23, 2013

hi,

   I am using CSLA3.8,and I found BusinessListBase's collection item are only child objects,but some times,we need root Objects to a list and show in view(DataGridView),In DataGridView we can edit these root objects.so how can i do that?you may suggest me that you should use EditableRootListBase,but in the C# Business Object book,it said EditableRootListBase if for  immediately commit the changes?

Is there any way to use root objects list like BusineesListBase? thank you

Bruce

cfarren replied on Monday, May 27, 2013

Hi Bruce,

I'm not sure I follow you. Can you please be a bit clearer as to what you are after?

JonnyBee replied on Tuesday, May 28, 2013

Hi Bruce,

In CSLA you must always have a "root" object that you call Save on to save the changes.
So when a BusinessListBase is the "root" all the items in the list is "child" objects that can only be saved in the context of Save the list.

You _can_ use a ReadOnlyList as the "toot" object for a fetch (following th UoW model) and add iuse this list in a grid. However this impålies that YOU take reposibility for calling Save and modify code so that you can replace the item in the readonly list.

What is the use-case you want to fulfill?

Copyright (c) Marimer LLC