示例#1
0
        public static Task <bool> ScopeExistsAsync(this ICollectionManager manager, string scopeName, Action <ScopeExistsOptions> configureOptions)
        {
            var options = new ScopeExistsOptions();

            configureOptions(options);

            return(manager.ScopeExistsAsync(scopeName, options));
        }
示例#2
0
        public async Task <bool> ScopeExistsAsync(string scopeName, ScopeExistsOptions options)
        {
            var uri = GetUri();

            Logger.LogInformation($"Attempting to verify if scope {scopeName} exists - {uri}");

            try
            {
                // get all scopes
                var scopes =
                    await GetAllScopesAsync(new GetAllScopesOptions { CancellationToken = options.CancellationToken })
                    .ConfigureAwait(false);

                // try find scope
                return(scopes.Any(scope => scope.Name == scopeName));
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Failed to verify if scope {scopeName} exists - {uri}");
                throw;
            }
        }