public static TEntity Add <TKey, TEntity>(this IAtomicWriter <TKey, TEntity> self, TKey key, TEntity newEntity)
 {
     return(self.AddOrUpdate(key, newEntity, e =>
     {
         var txt = String.Format("Entity '{0}' with key '{1}' should not exist.", typeof(TEntity).Name, key);
         throw new InvalidOperationException(txt);
     }, AddOrUpdateHint.ProbablyDoesNotExist));
 }
 public static TView UpdateOrThrow <TKey, TView>(this IAtomicWriter <TKey, TView> self, TKey key, Func <TView, TView> change)
 {
     return(self.AddOrUpdate(key, () =>
     {
         var txt = String.Format("Failed to load '{0}' with key '{1}'.", typeof(TView).Name, key);
         throw new InvalidOperationException(txt);
     }, change));
 }
 public static TEntity UpdateOrThrow <TKey, TEntity>(this IAtomicWriter <TKey, TEntity> self, TKey key, Action <TEntity> change)
 {
     return(self.AddOrUpdate(key, () =>
     {
         var txt = String.Format("Failed to load '{0}' with key '{1}'.", typeof(TEntity).Name, key);
         throw new InvalidOperationException(txt);
     }, change, AddOrUpdateHint.ProbablyExists));
 }
 public static TView UpdateOrThrow <TKey, TView>(this IAtomicWriter <TKey, TView> self, TKey key, Action <TView> update)
 {
     return(self.UpdateOrThrow(key, view =>
     {
         update(view);
         return view;
     }));
 }
 public static TView Add <TKey, TView>(this IAtomicWriter <TKey, TView> self, TKey key, TView newView)
 {
     return(self.AddOrUpdate(key, () => newView, view =>
     {
         var txt = String.Format("View '{0}' with key '{1}' should not exist.", typeof(TView).Name, key);
         throw new InvalidOperationException(txt);
     }));
 }
 public static TEntity AddOrUpdate <TKey, TEntity>(this IAtomicWriter <TKey, TEntity> self, TKey key, TEntity newView, Action <TEntity> updateViewFactory, AddOrUpdateHint hint = AddOrUpdateHint.ProbablyExists)
 {
     return(self.AddOrUpdate(key, () => newView, view =>
     {
         updateViewFactory(view);
         return view;
     }, hint));
 }
 public static TEntity AddOrUpdate <TKey, TEntity>(this IAtomicWriter <TKey, TEntity> self, TKey key, Func <TEntity> addFactory, Action <TEntity> update, AddOrUpdateHint hint = AddOrUpdateHint.ProbablyExists)
 {
     return(self.AddOrUpdate(key, addFactory, entity =>
     {
         update(entity);
         return entity;
     }, hint));
 }
 protected static void HandleAtomic(AtomicMessage msg, SimpleMessageSender sender, IAtomicWriter<unit, int> arg3)
 {
     var count = arg3.AddOrUpdate(unit.it, () => 1, i => i + 1);
     if (count > 2)
     {
         sender.SendBatch(new object[] {}, e => e.AddString("ok"));
         return;
     }
     sender.SendOne(new AtomicMessage());
 }
 public static TView UpdateEnforcingNew <TKey, TView>(this IAtomicWriter <TKey, TView> self, TKey key,
                                                      Action <TView> update, AddOrUpdateHint hint = AddOrUpdateHint.ProbablyExists)
     where TView : new()
 {
     return(self.AddOrUpdate(key, () =>
     {
         var view = new TView();
         update(view);
         return view;
     }, v =>
     {
         update(v);
         return v;
     }, hint));
 }
Exemple #10
0
        private static void MouseClickHandler(ImmutableEnvelope envelope, IAtomicWriter <unit, PointsView> writer)
        {
            var mouseMovedEvent = (MouseClick)envelope.Items[0].Content;

            writer.AddOrUpdate(unit.it, () => new PointsView(),
                               v =>
            {
                var Point = v.Points.FirstOrDefault(p => p.X == mouseMovedEvent.X && p.Y == mouseMovedEvent.Y);
                if (Point != null)
                {
                    Point.Intensity += 10;
                }
                else
                {
                    v.Points.Add(new HeatPoint(mouseMovedEvent.X, mouseMovedEvent.Y, 50));
                }
            });
        }
 public RecipeByNameIndexProjection(IAtomicWriter <unit, RecipeByNameIndex> writer)
 {
     this.writer = writer;
 }
 public RecipeByNameIndexProjection(IAtomicWriter<unit, RecipeByNameIndex> writer)
 {
     this.writer = writer;
 }
 public AccountLoginsProjection(IAtomicWriter <SecurityId, AccountLoginsView> writer)
 {
     _writer = writer;
 }
 public CustomerEventListener(IAtomicWriter <string, CustomerViewModel> writer)
 {
     _writer = writer;
 }
 public SecurityProjection(IAtomicWriter<SecurityId, SecurityView> writer)
 {
     _writer = writer;
 }
 public TaskDetailsProjection(IAtomicWriter <TaskId, TaskDetailsView> writer)
 {
     this.writer = writer;
 }
Exemple #17
0
 public TaskProjection(IAtomicWriter <TaskView> writer)
 {
     this.writer = writer;
 }
Exemple #18
0
        private static void MouseClickHandler(ImmutableEnvelope envelope, IAtomicWriter<unit, PointsView> writer)
        {
            var mouseMovedEvent = (MouseClick)envelope.Items[0].Content;

            writer.AddOrUpdate(unit.it, () => new PointsView(),
                v =>
                {
                    var Point = v.Points.FirstOrDefault(p => p.X == mouseMovedEvent.X && p.Y == mouseMovedEvent.Y);
                    if (Point != null)
                    {
                        Point.Intensity += 10;
                    }
                    else
                    {
                        v.Points.Add(new HeatPoint(mouseMovedEvent.X, mouseMovedEvent.Y, 50));
                    }
                });
        }
 public static void Update <TItem>(this IAtomicWriter <TItem> writer, int key, Func <TItem, TItem> update) where TItem : class
 {
     writer.AddOrUpdate(key, null, update);
 }
Exemple #20
0
        protected static void HandleAtomic(AtomicMessage msg, SimpleMessageSender sender, IAtomicWriter <unit, int> arg3)
        {
            var count = arg3.AddOrUpdate(unit.it, () => 1, i => i + 1);

            if (count > 2)
            {
                sender.SendBatch(new object[] {}, e => e.AddString("ok"));
                return;
            }
            sender.SendOne(new AtomicMessage());
        }
 public LoginViewProjection(IAtomicWriter <UserId, LoginView> writer)
 {
     _writer = writer;
 }
 public TaskDetailsProjection(IAtomicWriter<TaskId, TaskDetailsView> writer)
 {
     this.writer = writer;
 }
 public LoginsIndexProjection(IAtomicWriter <unit, LoginsIndexView> writer)
 {
     _writer = writer;
 }
 public LoginsIndexProjection(IAtomicWriter<unit, LoginsIndexView> writer)
 {
     _writer = writer;
 }
 public SecurityProjection(IAtomicWriter <SecurityId, SecurityView> writer)
 {
     _writer = writer;
 }
 public LoginViewProjection(IAtomicWriter<UserId, LoginView> writer)
 {
     _writer = writer;
 }
 public AccountLoginsProjection(IAtomicWriter<SecurityId, AccountLoginsView> writer)
 {
     _writer = writer;
 }
 public RecipeProjection(IAtomicWriter<RecipeId, RecipeView> writer)
 {
     this.writer = writer;
 }
 public RecipeProjection(IAtomicWriter <RecipeId, RecipeView> writer)
 {
     this.writer = writer;
 }
Exemple #30
0
 public HeatMapGenerateTask(IAtomicReader <unit, PointsView> reader, IAtomicWriter <unit, HeatMapView> mapWriter)
 {
     _reader    = reader;
     _mapWriter = mapWriter;
 }
 public static void Add <TItem>(this IAtomicWriter <TItem> writer, int key, Func <TItem> addFactory) where TItem : class
 {
     writer.AddOrUpdate(key, addFactory, null, false);
 }
 public TaskProjection(IAtomicWriter<TaskView> writer)
 {
     this.writer = writer;
 }