示例#1
0
 public void Upsert(SOCState s)
 {
     SOCState existing;
     if (aggregates.TryGetValue(s.AggregateId, out  existing))
     {
         existing.Title = s.Title;
         existing.LastUpdated = s.LastUpdated;
     }
     else
     {
         aggregates.Add(s.AggregateId, s);
     }
 }
示例#2
0
        public IActionResult AddSoc(SOC newSoc)
        {
            _data.AddOrUpdateSoc(newSoc,(newId)=>
            {
                //Update base query store
                var d = _data.GetSoc(newId);
                var state = new SOCState() { AggregateId=d.AggregateId,Title=d.Titel,LastUpdated=d.UpDateTime };
                _queryStore.Upsert(state);
                var statistics=_data.GetList(newSoc.AggregateId).Count();

                //update statistics store
                var stat = new SOCStatistics() { AggregateId = newSoc.AggregateId, Title = newSoc.Titel, LastUpdated = newSoc.UpDateTime, NoOfUpdates = statistics };
                _statistics.Upsert(stat);
            });
            return RedirectToAction("Index");
        }
示例#3
0
 public SOCState Get(Guid id)
 {
     SOCState soc = new SOCState();
     aggregates.TryGetValue(id, out soc);
     return soc;
 }