public void Load() { HistoryMessage = RepositoryProvider.GetRepository().Get <List <Message> >($"{_persistIdentity}_HistoryMessage") ?? new List <Message>(); ErrorMessage = RepositoryProvider.GetRepository().Get <List <Message> >($"{_persistIdentity}_ErrorMessage") ?? new List <Message>(); PendingMessage = RepositoryProvider.GetRepository().Get <List <Message> >($"{_persistIdentity}_PendingMessage") ?? new List <Message>(); PendingMessage.ForEach(QueueMessager.Enqueue); var queuedMessages = RepositoryProvider.GetRepository().Get <List <Message> >($"{_persistIdentity}_QueuedMessage") ?? new List <Message>(); queuedMessages.ForEach(QueueMessager.Enqueue); }
public void Save() { lock (_lock) { RepositoryProvider.GetRepository().Save <List <Message> >($"{_persistIdentity}_HistoryMessage", HistoryMessage); RepositoryProvider.GetRepository().Save <List <Message> >($"{_persistIdentity}_ErrorMessage", ErrorMessage); RepositoryProvider.GetRepository().Save <List <Message> >($"{_persistIdentity}_PendingMessage", PendingMessage); RepositoryProvider.GetRepository().Save <List <Message> >($"{_persistIdentity}_QueuedMessage", QueueMessager.GetQueuedMessages()); } }