コード例 #1
0
        public void can_store_and_retrieve_model()
        {
            var model = new SampleReadModelWithStringKey()
            {
                Id = "a"
            };

            _inmemoryCollection.Save(model);

            var loaded = _inmemoryCollection.GetById("a");

            Assert.AreSame(model, loaded);
            Assert.AreEqual(1, _inmemoryCollection.GetAll().Count());
        }
コード例 #2
0
 public TModel FindOneById(TKey id)
 {
     return(_inmemoryCollection.IsActive ?
            _inmemoryCollection.GetById(id) :
            _storage.FindOneById(id));
 }
コード例 #3
0
 public async Task <TModel> FindOneByIdAsync(TKey id)
 {
     return(_inmemoryCollection.IsActive ?
            _inmemoryCollection.GetById(id) :
            await _storage.FindOneByIdAsync(id).ConfigureAwait(false));
 }