public void Insert()
        {
            using (var uow = _unitOfWorkFactory.Create())
            {
                foreach (var item in GetSettingsString())
                {
                    var settings = new SystemSettings
                    {
                        Id = Guid.NewGuid(),
                        Key = item.Key,
                        Value = item.Value
                    };
                    uow.GetRepository.Add(settings);
                }

                uow.Commit();
            }
        }
示例#2
0
 public void Create(string key, string value)
 {
     try
     {
         using (var uow = _unitOfWorkFactory.Value.Create())
         {
             var systemSettings = new SystemSettings
             {
                 Id = Guid.NewGuid(),
                 Key = key,
                 Value = value
             };
             uow.GetRepository.Add(systemSettings);
             uow.Commit();
         }
     }
     catch (Exception ex)
     {
         throw new SettingsServiceFatalException(ex);
     }
 }