DbArchiveRecord InsertReference(MappedTable <DbArchiveRecord> table, IReferenceJson reference, DateTime lastFetchedUtc) { DbArchiveRecord archiveRecord = new DbArchiveRecord(); archiveRecord.Id = reference.Id; archiveRecord.LastFetchedUtc = lastFetchedUtc; archiveRecord.Json = reference.RawJson; Mapper.InsertRecord(table, archiveRecord, SQLiteConflictResolution.Replace); return(archiveRecord); }
public void InsertReference(IReferenceJson reference, DateTime lastFetchedUtc) { // Based on ReferenceJsonConverter.typeMap if (reference.GetType() == typeof(JsonUserReference)) { var archiveRecord = InsertReference(this.ArchiveUserRefs, reference, lastFetchedUtc); if (UserRefInserted != null) { UserRefInserted(this, new ArchiveInsertEventArgs <DbArchiveRecord>(archiveRecord)); } } else if (reference.GetType() == typeof(JsonGroupReference)) { var archiveRecord = InsertReference(this.ArchiveGroupRefs, reference, lastFetchedUtc); if (GroupRefInserted != null) { GroupRefInserted(this, new ArchiveInsertEventArgs <DbArchiveRecord>(archiveRecord)); } } else if (reference.GetType() == typeof(JsonConversationReference)) { var archiveRecord = InsertReference(this.ArchiveConversationRefs, reference, lastFetchedUtc); if (ConversationRefInserted != null) { ConversationRefInserted(this, new ArchiveInsertEventArgs <DbArchiveRecord>(archiveRecord)); } } else if (reference.GetType() == typeof(ThreadReferenceJson)) { InsertReference(this.ArchiveThreadRefs, reference, lastFetchedUtc); } else if (reference.GetType() == typeof(JsonPageReference)) { InsertReference(this.ArchivePageRefs, reference, lastFetchedUtc); } else if (reference.GetType() == typeof(JsonMessageReference)) { InsertReference(this.ArchiveMessageRefs, reference, lastFetchedUtc); } else if (reference.GetType() == typeof(JsonTopicReference)) { InsertReference(this.ArchiveTopicRefs, reference, lastFetchedUtc); } else { Debug.WriteLine("WARNING: Unknown reference type {0}", reference.GetType().Name); } }
public JsonMessageEnvelope() { Messages = new JsonMessage[0]; References = new IReferenceJson[0]; ThreadedExtended = new Dictionary <long, JsonMessage[]>(); }