How to set child property into null value when the root object is initialize

How to set child property into null value when the root object is initialize

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


sutono posted on Thursday, June 16, 2011

HI All,

please someone tell me how to set child property into null value when the root object is initialize...

i need this because of my specific business case, i have a parent object that contain a lot of editable child property inside, and sometimes user can fill in some of the child information (not all) thats why i need the validation at the root object to determine which child is not filled in.

private static PropertyInfo<PDGravureSR> _PDGravureSRProperty = RegisterProperty<PDGravureSR>(p => p.PDGravureSR);

        public PDGravureSR PDGravureSR

        {

            get

            {

                if (!(FieldManager.FieldExists(_PDGravureSRProperty)) || FieldManager.GetFieldData(_PDGravureSRProperty).Value == null)

                    LoadProperty(_PDGravureSRProperty, PDGravureSR.New(F_Id));

                return GetProperty(_PDGravureSRProperty);

            }

        }

 

i have this child property inside my root object, each time my root object was initialize, this property will always assigned by its default value, i know CSLA framework made this for "lazy loading" purpose, but is there any ways to set this child property into "null" when its initialize, so that i can have my validation on UI.

Thx,

Stone

Copyright (c) Marimer LLC