Пример #1
0
        public virtual IReadOnlyCollection <XElement> GetAllElements()
        {
            var list = DbStore.GetAll(_connectionString);

            _logger.LogInformation($"Succeeded to get '{list.Count}' item(s).");
            return(list.Select(x => XElement.Parse(x.Value)).ToList().AsReadOnly());
        }
Пример #2
0
 public void StoreElement(XElement element, string name)
 {
     try
     {
         DbStore.Save(_connectionString, new DataProtectionKey
         {
             Name  = name,
             Value = element.ToString(SaveOptions.DisableFormatting)
         });
         _logger.LogInformation($"Succeeded to save key '{name}'.");
     }
     catch (Exception ex)
     {
         _logger.LogError($"Failed to save key '{name}': {ex.Message}.");
         throw ex;
     }
 }