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()); }
public TModel FindOneById(TKey id) { return(_inmemoryCollection.IsActive ? _inmemoryCollection.GetById(id) : _storage.FindOneById(id)); }
public async Task <TModel> FindOneByIdAsync(TKey id) { return(_inmemoryCollection.IsActive ? _inmemoryCollection.GetById(id) : await _storage.FindOneByIdAsync(id).ConfigureAwait(false)); }