public (int, int, string) GetLastBlockLevel() { lock (_dbLock) { if (lastBlock == null) { lastBlock = _db.LastBlock.SingleOrDefault(); } if (lastBlock == null) { lastBlock = new LastBlock { Level = 0 }; _db.LastBlock.Add(lastBlock); _db.SaveChanges(); } return(lastBlock.Level, lastBlock.Priority, lastBlock.Hash); } }
public void SaveMessage(Message message) { using var db = new TezosDataContext(_dbOptions); db.Add(message); db.SaveChanges(); }