Beginner Question: Is the design of a read-only parent with editable child collection acceptable?Beginner Question: Is the design of a read-only parent with editable child collection acceptable?
Old forum URL: forums.lhotka.net/forums/t/7237.aspx
superkuton posted on Tuesday, July 07, 2009
I have a Student Object which has a child collection of ContactAddresses, ContactPersons and ContactNumbers.
In my UI in my previous (ADO.NET) app, I have a dialog form where I fetch the 3 Contact___ objects using the primary (StudentID) key of the parent object.
In the new CSLA-based app I am developing I thought of using a read-only parent (Student) that will manage the 3 Contact objects as editable child collection.
In CSLA, where the emphasis is on use cases, is this design still acceptable or there are better alternatives, or a better design option?
Thank you for helping a newbie in data access programming and in CSLA.
skagen00 replied on Tuesday, July 07, 2009
I don't think that's the right way to go... this really depends entirely on your use case but it certainly seems like you're managing a student's contact information in general...
Make your Student an editable root. Even if you don't change anything on that class (i.e. everything is read-only) your student class should manage the three collections, which should be editable child collections.
Is there a context where you actually manage student information separately?superkuton replied on Tuesday, July 07, 2009
Thanks for the immediate response.
In my UI, I present the Student Object (editable root)
with
read-only child lists of certain records:
- Contact Addresses
- Contact Numbers
- Contact Persons
- Training records
- Employment records
- etc.
When the user will edit the Training records, an editable Training Object is presented in another form.
When the user will edit the Contact Information, 1, 2 & 3 above, I present the editable child collection of the 3 contact information in another form.
So, to do the editing of contact information, i should create another Student (editable root)
which contains the child collections for the 3 contact information. Is this correct?
Thanks.
Copyright (c) Marimer LLC