Esempio n. 1
0
        public Task <Person?> GetAsync(Guid id)
        {
            return(DataSvcInvoker.Default.InvokeAsync(this, async() =>
            {
                var __key = new UniqueKey(id);
                if (ExecutionContext.Current.TryGetCacheValue <Person?>(__key, out Person? __val))
                {
                    return __val;
                }

                var __result = await _data.GetAsync(id).ConfigureAwait(false);
                ExecutionContext.Current.CacheSet(__key, __result !);
                if (_OnAfterGetAsync != null)
                {
                    await _OnAfterGetAsync(__result, id).ConfigureAwait(false);
                }
                return __result;
            }));
Esempio n. 2
0
        public Task <Person?> GetAsync(Guid id)
        {
            return(DataSvcInvoker.Current.InvokeAsync(this, async() =>
            {
                var __key = new UniqueKey(id);
                if (_cache.TryGetValue(__key, out Person? __val))
                {
                    return __val;
                }

                var __result = await _data.GetAsync(id).ConfigureAwait(false);
                _cache.SetValue(__key, __result);
                if (_getOnAfterAsync != null)
                {
                    await _getOnAfterAsync(__result, id).ConfigureAwait(false);
                }
                return __result;
            }));