diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs index 0a00902a..e1ce0030 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs @@ -79,13 +79,10 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, - /// whose result returns the unique identifier associated with the application. + /// A that can be used to monitor the asynchronous operation. /// - public virtual Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) - { - return CreateAsync(application, /* secret: */ null, cancellationToken); - } + public virtual Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) + => CreateAsync(application, /* secret: */ null, cancellationToken); /// /// Creates a new application. @@ -96,10 +93,9 @@ namespace OpenIddict.Core /// The client secret associated with the application, if applicable. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, - /// whose result returns the unique identifier associated with the application. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task CreateAsync( + public virtual async Task CreateAsync( [NotNull] TApplication application, [CanBeNull] string secret, CancellationToken cancellationToken = default) { @@ -141,7 +137,7 @@ namespace OpenIddict.Core try { - return await Store.CreateAsync(application, cancellationToken); + await Store.CreateAsync(application, cancellationToken); } catch (Exception exception) @@ -183,10 +179,14 @@ namespace OpenIddict.Core if (!string.IsNullOrEmpty(secret)) { await Store.SetClientSecretAsync(application, /* secret: */ null, cancellationToken); - return await CreateAsync(application, secret, cancellationToken); + await CreateAsync(application, secret, cancellationToken); + } + else + { + await CreateAsync(application, cancellationToken); } - return await CreateAsync(application, cancellationToken); + return application; } /// diff --git a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs index bbd62009..8e1bc2cb 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs @@ -78,10 +78,9 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task CreateAsync( - [NotNull] TAuthorization authorization, CancellationToken cancellationToken = default) + public virtual async Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default) { if (authorization == null) { @@ -98,7 +97,7 @@ namespace OpenIddict.Core try { - return await Store.CreateAsync(authorization, cancellationToken); + await Store.CreateAsync(authorization, cancellationToken); } catch (Exception exception) @@ -132,7 +131,9 @@ namespace OpenIddict.Core } await PopulateAsync(authorization, descriptor, cancellationToken); - return await CreateAsync(authorization, cancellationToken); + await CreateAsync(authorization, cancellationToken); + + return authorization; } /// diff --git a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs index a6c00a7d..1319f759 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs @@ -78,9 +78,9 @@ namespace OpenIddict.Core /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken = default) + public virtual async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken = default) { if (scope == null) { @@ -89,7 +89,7 @@ namespace OpenIddict.Core try { - return await Store.CreateAsync(scope, cancellationToken); + await Store.CreateAsync(scope, cancellationToken); } catch (Exception exception) @@ -123,7 +123,9 @@ namespace OpenIddict.Core } await PopulateAsync(scope, descriptor, cancellationToken); - return await CreateAsync(scope, cancellationToken); + await CreateAsync(scope, cancellationToken); + + return scope; } /// diff --git a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs index fbea0336..9db48cbb 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs @@ -80,9 +80,9 @@ namespace OpenIddict.Core /// The token. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public virtual async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken = default) + public virtual async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken = default) { if (token == null) { @@ -93,7 +93,7 @@ namespace OpenIddict.Core try { - return await Store.CreateAsync(token, cancellationToken); + await Store.CreateAsync(token, cancellationToken); } catch (Exception exception) @@ -127,7 +127,9 @@ namespace OpenIddict.Core } await PopulateAsync(token, descriptor, cancellationToken); - return await CreateAsync(token, cancellationToken); + await CreateAsync(token, cancellationToken); + + return token; } /// diff --git a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs index 8c87415c..7d44a177 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); /// /// Removes an existing application. diff --git a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs index 94e0146b..2f792847 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); /// /// Removes an existing authorization. diff --git a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs index e061433d..8c0a48d7 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); /// /// Removes an existing scope. diff --git a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs index 4c1581bd..11ca3528 100644 --- a/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs +++ b/src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs @@ -48,9 +48,9 @@ namespace OpenIddict.Core /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); + Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); /// /// Removes a token. diff --git a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs index 7596af58..a42ea82d 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs @@ -62,9 +62,9 @@ namespace OpenIddict.Core /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); /// /// Removes an existing application. diff --git a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs index acdd7e25..be3934c5 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs @@ -63,9 +63,9 @@ namespace OpenIddict.Core /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); /// /// Removes an existing authorization. diff --git a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs index a9aa4652..902d707b 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs @@ -58,9 +58,9 @@ namespace OpenIddict.Core /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); /// /// Removes an existing scope. diff --git a/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs index 39419e13..aaa782df 100644 --- a/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs +++ b/src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs @@ -62,9 +62,9 @@ namespace OpenIddict.Core /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public abstract Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); + public abstract Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); /// /// Removes a token. diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs index adaaeb7b..057b8592 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) { if (application == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFramework Applications.Add(application); - await Context.SaveChangesAsync(cancellationToken); - - return application; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs index 00ca7ba5..bf6fe2ed 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) { if (authorization == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFramework Authorizations.Add(authorization); - await Context.SaveChangesAsync(cancellationToken); - - return authorization; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs index e85f866a..f1c6bb14 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs @@ -98,9 +98,9 @@ namespace OpenIddict.EntityFramework /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) { if (scope == null) { @@ -109,9 +109,7 @@ namespace OpenIddict.EntityFramework Scopes.Add(scope); - await Context.SaveChangesAsync(cancellationToken); - - return scope; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs index 93404579..e140c420 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs @@ -117,9 +117,9 @@ namespace OpenIddict.EntityFramework /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) { if (token == null) { @@ -128,9 +128,7 @@ namespace OpenIddict.EntityFramework Tokens.Add(token); - await Context.SaveChangesAsync(cancellationToken); - - return token; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs index 82734798..52f03a75 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore /// The application to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the application. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) { if (application == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFrameworkCore Context.Add(application); - await Context.SaveChangesAsync(cancellationToken); - - return application; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs index d683d90c..3e9b2bed 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs @@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore /// The authorization to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the authorization. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) { if (authorization == null) { @@ -129,9 +129,7 @@ namespace OpenIddict.EntityFrameworkCore Context.Add(authorization); - await Context.SaveChangesAsync(cancellationToken); - - return authorization; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs index 24f857d6..e206da52 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs @@ -98,9 +98,9 @@ namespace OpenIddict.EntityFrameworkCore /// The scope to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the scope. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) { if (scope == null) { @@ -109,9 +109,7 @@ namespace OpenIddict.EntityFrameworkCore Scopes.Add(scope); - await Context.SaveChangesAsync(cancellationToken); - - return scope; + return Context.SaveChangesAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs index 3aa667ae..4fc1ed2b 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs @@ -117,9 +117,9 @@ namespace OpenIddict.EntityFrameworkCore /// The token to create. /// The that can be used to abort the operation. /// - /// A that can be used to monitor the asynchronous operation, whose result returns the token. + /// A that can be used to monitor the asynchronous operation. /// - public override async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) + public override Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) { if (token == null) { @@ -128,9 +128,7 @@ namespace OpenIddict.EntityFrameworkCore Context.Add(token); - await Context.SaveChangesAsync(cancellationToken); - - return token; + return Context.SaveChangesAsync(cancellationToken); } ///