/// <summary>
        /// Obtains a scope description from Overture including the currency of the scope, but not its children.
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public virtual Task <Scope> GetScopeAsync(GetScopeParam param)
        {
            if (param == null)
            {
                throw new ArgumentNullException(nameof(param));
            }
            if (string.IsNullOrWhiteSpace(param.Scope))
            {
                throw new ArgumentException("Scope is required", nameof(param.Scope));
            }

            var key = new CacheKey(CacheConfigurationCategoryNames.Scopes, param.Scope);

            var scope = CacheProvider.GetOrAddAsync(key, async() =>
            {
                var req = new GetScopeRequest
                {
                    ScopeId         = param.Scope,
                    IncludeCurrency = true,
                    IncludeChildren = false,
                    CultureName     = null
                };

                var response = await OvertureClient.SendAsync(req).ConfigureAwait(false);
                return(response);
            });

            return(scope);
        }
Ejemplo n.º 2
0
        public virtual Task <Scope> GetAllScopesAsync()
        {
            var key = new CacheKey(CacheConfigurationCategoryNames.Scopes, nameof(GetAllScopesAsync));

            return(CacheProvider.GetOrAddAsync(key, () =>
            {
                var getScopeRequest = new GetScopeRequest
                {
                    ScopeId = "Global",
                    IncludeCurrency = false,
                    IncludeChildren = true,
                    CultureName = null
                };

                return OvertureClient.SendAsync(getScopeRequest);
            }));
        }