Just mark all obj or collection as child but not root ? Will it occur some problem
You cannot call Save() on a Child object and you cannon call BeginEdit, ApplyEdit, CancelEdit on editable collection that is marked as Child.
You could override the default Save method tho:
public virtual T Save() { T result; if (this.IsChild) throw new InvalidOperationException(Resources.NoSaveChildException); if (EditLevel > 0) throw new InvalidOperationException(Resources.NoSaveEditingException); if (!IsValid && !IsDeleted) throw new Rules.ValidationException(Resources.NoSaveInvalidException); if (IsBusy) throw new InvalidOperationException(Resources.BusyObjectsMayNotBeSaved); if (IsDirty) result = (T)DataPortal.Update(this); else result = (T)this; OnSaved(result, null, null); return result; }
In my project, I want to create a XmlModelBase derive from BusinessBase and implement auto save and fetch from xml file. But I don't want to relize four suit code(a child obj , a root obj, a child business list, a root business list ). Now I have implemented two suit for Child Business Obj and Child Business List Obj. Can I declare a root obj and all child obj's parent reference to this root obj.
Copyright (c) Marimer LLC