コード例 #1
0
 public void Add(ABTest.ABRuleSetting item)
 {
     if (null != item)
     {
         UpdateOrAdd(item, item);
     }
 }
コード例 #2
0
        public ABTest.ABRuleSetting Get(ABTest.ABRuleSetting dummy)
        {
            var temp = _dbContext.ABRuleSettings.Where(it => it.UUID.Equals(dummy.UUID, StringComparison.OrdinalIgnoreCase));

            if (null != dummy.Site)
            {
                temp = temp.Where(it => it.SiteName.Equals(dummy.Site.FullName, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                temp = temp.Where(it => String.IsNullOrEmpty(it.SiteName));
            }
            var result = temp.ToList()
                         .Select(it => it.ToABRuleSetting())
                         .FirstOrDefault();

            return(result);
        }
コード例 #3
0
        public void Remove(ABTest.ABRuleSetting item)
        {
            ((IPersistable)item).OnSaving();
            var dummy = _dbContext.ABRuleSettings.Where(it => it.UUID.Equals(item.UUID, StringComparison.OrdinalIgnoreCase));

            if (null != item.Site)
            {
                dummy = dummy.Where(it => it.SiteName.Equals(item.Site.FullName, StringComparison.OrdinalIgnoreCase));
            }
            else
            {
                dummy = dummy.Where(it => String.IsNullOrEmpty(it.SiteName));
            }
            var temp = dummy.FirstOrDefault();

            if (null != temp)
            {
                _dbContext.ABRuleSettings.Remove(temp);
                _dbContext.SaveChanges();
            }
            ((IPersistable)item).OnSaved();
        }
コード例 #4
0
 public void Update(ABTest.ABRuleSetting @new, ABTest.ABRuleSetting old)
 {
     UpdateOrAdd(@new, old);
 }