public async Task get_with_async_fetch() { var target = Target.Random(); var json = theStore.Advanced.Serializer.ToJson(target).ToReader(); var version = Guid.NewGuid(); await theIdentityMap.GetAsync(target.Id, tkn => { return(Task.FromResult(new FetchResult <Target>(target, json, version))); }, default(CancellationToken)); theIdentityMap.Versions.Version <Target>(target.Id) .ShouldBe(version); }
public Task <T> ResolveAsync(IIdentityMap map, ILoader loader, CancellationToken token, object id) { return(map.GetAsync(id, tk => loader.LoadDocumentAsync <TBase>(id, tk), token) .ContinueWith(x => x.Result as T, token)); }
public Task <T> ResolveAsync(IIdentityMap map, ILoader loader, CancellationToken token, object id) { return(map.GetAsync(id, async tk => await loader.LoadDocumentAsync <T>(id, tk).ConfigureAwait(false), token)); }