/// <summary> /// Duplicates DbContentHit object into a database; may or may not be the same database /// as the parent object. /// </summary> /// <returns> A new DbContentHit object reflecting the replicated DbContentHit object.</returns> public DbContentHit Duplicate() { DbContentHit clonedDbContentHit = this.Clone(); // Insert must be called after children are replicated! clonedDbContentHit.iD = DbContentHitManager._insert(clonedDbContentHit); clonedDbContentHit.isSynced = true; return(clonedDbContentHit); }
/// <summary> /// Saves the DbContentHit object state to the database. /// </summary> public int Save() { if (isSynced) { return(iD); } if (iD == -1) { throw (new Exception("Invalid record; cannot be saved.")); } if (iD == 0) { iD = DbContentHitManager._insert(this); } else { DbContentHitManager._update(this); } isSynced = iD != -1; return(iD); }