Beispiel #1
0
 public static TEntity UpdateOrThrow <TKey, TEntity>(this IAtomicEntityWriter <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));
 }
Beispiel #2
0
 public static TEntity AddOrUpdate <TKey, TEntity>(this IAtomicEntityWriter <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));
 }
Beispiel #3
0
 public static TEntity Add <TKey, TEntity>(this IAtomicEntityWriter <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));
 }
Beispiel #4
0
 public static TEntity AddOrUpdate <TKey, TEntity>(this IAtomicEntityWriter <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));
 }
Beispiel #5
0
 public static TView UpdateEnforcingNew <TKey, TView>(this IAtomicEntityWriter <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));
 }
 public ActivityListHandler(IAtomicEntityWriter <Identity, ActivityList> writer)
 {
     _writer = writer;
 }
 public NoteViewHandler(IAtomicEntityWriter <Identity, NoteView> writer)
 {
     _writer = writer;
 }
 public StoryViewHandler(IAtomicEntityWriter <Identity, StoryView> writer)
 {
     _writer = writer;
 }
Beispiel #9
0
 public TagViewHandler(IAtomicEntityWriter <TagId, TagView> writer)
 {
     _writer = writer;
 }
Beispiel #10
0
 public TaskListHandler(IAtomicEntityWriter <Identity, TaskList> writer)
 {
     _writer = writer;
 }
 public ViewUpdater(IAtomicEntityWriter <TKey, TView> inner)
 {
     _inner = inner;
 }
 public NoteListHandler(IAtomicEntityWriter <Identity, NoteList> writer)
 {
     _writer = writer;
 }