コード例 #1
0
        public static async Task <TOutput> CreateOrRetriveRetreiveObjectFromStoreAsync <TOutput, TKey>(
            this IPersistentStore <TKey, string> store,
            TKey key,
            TOutput defaultVal,
            CancellationToken token)
        {
            await store.SetIfNotPresentAsync(key, InsightsUtil.Serialize(defaultVal), token).ConfigureAwait(false);

            var deserialized = await store.GetEntityAsync(key, token).ConfigureAwait(false);

            return(InsightsUtil.DeSerialize <TOutput>(deserialized));
        }