コード例 #1
0
        public async Task <bool> Execute(Scope scope)
        {
            if (scope == null)
            {
                throw new ArgumentNullException(nameof(scope));
            }

            if (await _scopeRepository.GetAsync(scope.Name) != null)
            {
                throw new IdentityServerManagerException(
                          ErrorCodes.InvalidParameterCode,
                          string.Format(ErrorDescriptions.TheScopeAlreadyExists, scope.Name));
            }

            return(await _scopeRepository.InsertAsync(scope));
        }