Do I need to add the MarkAsChild() statement?

Do I need to add the MarkAsChild() statement?

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


helloworld posted on Tuesday, March 13, 2007

Dear All,

I am a new to CSLA.NET framework. I have got a simple question, would somebody please help me? Thanks.

I am trying to create an windows application using the CSLA.NET framework and there is only one [Location] table in the access database. I placed a DataGridView object on the form and would like to bind it with the location records.

I created a Location class which inherits from BusinessBase and also a LocationList class which inherits from BusinessListBase(Of LocationList,Location).

The question is that, is the Location class considered to be child meaning that I need to add the MarkAsChild() statement to its constructor?

Thanks in advance.

ajj3085 replied on Tuesday, March 13, 2007

It depends on your use case.  As the user edits each row in the grid, should the row save it self independately of the other rows?  Or MUST the entire list be saved in a single transaction?

If its the former case, then you'll want LocationList to inherit EditableRootListBase and you won't call MarkAsChild in the Location class.

If the ENTIRE list must be saved at once, then Location should call MarkAsChild and your LocationList is fine as is.

helloworld replied on Tuesday, March 13, 2007

ajj3085:
It depends on your use case.  As the user edits each row in the grid, should the row save it self independately of the other rows?  Or MUST the entire list be saved in a single transaction?

If its the former case, then you'll want LocationList to inherit EditableRootListBase and you won't call MarkAsChild in the Location class.

If the ENTIRE list must be saved at once, then Location should call MarkAsChild and your LocationList is fine as is.

Thank you very much for your help. Your answer is very helpful.

I guess I will inherit from the EditableRootListBase.

Copyright (c) Marimer LLC