Esempio n. 1
0
        public static Optional <TEntity> Get <TKey, TEntity>(this IAtomicReader <TKey, TEntity> self, TKey key)
        {
            TEntity entity;

            if (self.TryGet(key, out entity))
            {
                return(entity);
            }
            return(Optional <TEntity> .Empty);
        }
Esempio n. 2
0
        public static Optional <TSingleton> Get <TSingleton>(this IAtomicReader <unit, TSingleton> reader)
        {
            TSingleton singleton;

            if (reader.TryGet(unit.it, out singleton))
            {
                return(singleton);
            }
            return(Optional <TSingleton> .Empty);
        }
Esempio n. 3
0
        public static TView GetOrNew <TView>(this IAtomicReader <unit, TView> reader)
            where TView : new()
        {
            TView view;

            if (reader.TryGet(unit.it, out view))
            {
                return(view);
            }
            return(new TView());
        }
Esempio n. 4
0
        public static TEntity Load <TKey, TEntity>(this IAtomicReader <TKey, TEntity> self, TKey key)
        {
            TEntity entity;

            if (self.TryGet(key, out entity))
            {
                return(entity);
            }
            var txt = string.Format("Failed to load '{0}' with key '{1}'.", typeof(TEntity).Name, key);

            throw new InvalidOperationException(txt);
        }
 public RecipeProvider(IAtomicReader<RecipeId, RecipeView> reader,
     IAtomicReader<unit, RecipeByNameIndex> indexReader)
 {
     this.reader = reader;
     this.indexReader = indexReader;
 }
 public HeatMapRequestHandler(IAtomicReader<unit, HeatMapView> reader )
 {
     _reader = reader;
 }
Esempio n. 7
0
 public HeatMapGenerateTask(IAtomicReader <unit, PointsView> reader, IAtomicWriter <unit, HeatMapView> mapWriter)
 {
     _reader    = reader;
     _mapWriter = mapWriter;
 }
Esempio n. 8
0
 public RecipeProvider(IAtomicReader <RecipeId, RecipeView> reader,
                       IAtomicReader <unit, RecipeByNameIndex> indexReader)
 {
     this.reader      = reader;
     this.indexReader = indexReader;
 }
Esempio n. 9
0
 public HeatMapRequestHandler(IAtomicReader <unit, HeatMapView> reader)
 {
     _reader = reader;
 }