protected virtual bool Persist(IPersistence persistence, ref ePersistence phase) { switch (phase) { case ePersistence.Initial: persistence.UpsertField(Constants.BaseNode_Reference, Reference); persistence.UpsertField(Constants.BaseNode_NodeCount, IsReadOnly() ? "0" : Nodes.Count.ToString()); persistence.UpsertField(Constants.BaseNode_Type, NodeType.ToString()); persistence.UpsertField(Constants.BaseNode_Name, _Name); persistence.UpsertField(Constants.BaseNode_Description, _Description); break; case ePersistence.Final: if (!IsReadOnly()) { foreach (IBaseNode node in Nodes) { if (persistence.AddRecord()) { string type = Tree.BaseNodePersistName(node); persistence.UpsertField(Constants.BaseNode_ClassType, type); node.Persist(persistence); } } } break; } return(true); }
protected override bool Persist(IPersistence persistence, ref ePersistence phase) { if (persistence.AddRecord()) { string type = IDecisionTreeInterface.BaseNodePersistName(RootNode); persistence.UpsertField(Constants.BaseNode_ClassType, type); phase = ePersistence.Final; return(RootNode.Persist(persistence)); } return(false); }