Browse Source

Make the CreateAsync() API consistent with DeleteAsync()/UpdateAsync()

pull/546/head
Kévin Chalet 8 years ago
parent
commit
173c89231f
  1. 24
      src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs
  2. 11
      src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs
  3. 10
      src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs
  4. 10
      src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs
  5. 4
      src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs
  6. 4
      src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs
  7. 4
      src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs
  8. 4
      src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs
  9. 4
      src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs
  10. 4
      src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs
  11. 4
      src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs
  12. 4
      src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs
  13. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs
  14. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs
  15. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs
  16. 8
      src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs
  17. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs
  18. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs
  19. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs
  20. 8
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs

24
src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs

@ -79,13 +79,10 @@ namespace OpenIddict.Core
/// <param name="application">The application to create.</param> /// <param name="application">The application to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// whose result returns the unique identifier associated with the application.
/// </returns> /// </returns>
public virtual Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default) public virtual Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken = default)
{ => CreateAsync(application, /* secret: */ null, cancellationToken);
return CreateAsync(application, /* secret: */ null, cancellationToken);
}
/// <summary> /// <summary>
/// Creates a new application. /// Creates a new application.
@ -96,10 +93,9 @@ namespace OpenIddict.Core
/// <param name="secret">The client secret associated with the application, if applicable.</param> /// <param name="secret">The client secret associated with the application, if applicable.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// whose result returns the unique identifier associated with the application.
/// </returns> /// </returns>
public virtual async Task<TApplication> CreateAsync( public virtual async Task CreateAsync(
[NotNull] TApplication application, [NotNull] TApplication application,
[CanBeNull] string secret, CancellationToken cancellationToken = default) [CanBeNull] string secret, CancellationToken cancellationToken = default)
{ {
@ -141,7 +137,7 @@ namespace OpenIddict.Core
try try
{ {
return await Store.CreateAsync(application, cancellationToken); await Store.CreateAsync(application, cancellationToken);
} }
catch (Exception exception) catch (Exception exception)
@ -183,10 +179,14 @@ namespace OpenIddict.Core
if (!string.IsNullOrEmpty(secret)) if (!string.IsNullOrEmpty(secret))
{ {
await Store.SetClientSecretAsync(application, /* secret: */ null, cancellationToken); 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;
} }
/// <summary> /// <summary>

11
src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs

@ -78,10 +78,9 @@ namespace OpenIddict.Core
/// <param name="authorization">The application to create.</param> /// <param name="authorization">The application to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the authorization. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public virtual async Task<TAuthorization> CreateAsync( public virtual async Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
[NotNull] TAuthorization authorization, CancellationToken cancellationToken = default)
{ {
if (authorization == null) if (authorization == null)
{ {
@ -98,7 +97,7 @@ namespace OpenIddict.Core
try try
{ {
return await Store.CreateAsync(authorization, cancellationToken); await Store.CreateAsync(authorization, cancellationToken);
} }
catch (Exception exception) catch (Exception exception)
@ -132,7 +131,9 @@ namespace OpenIddict.Core
} }
await PopulateAsync(authorization, descriptor, cancellationToken); await PopulateAsync(authorization, descriptor, cancellationToken);
return await CreateAsync(authorization, cancellationToken); await CreateAsync(authorization, cancellationToken);
return authorization;
} }
/// <summary> /// <summary>

10
src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs

@ -78,9 +78,9 @@ namespace OpenIddict.Core
/// <param name="scope">The scope to create.</param> /// <param name="scope">The scope to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the scope. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public virtual async Task<TScope> CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken = default) public virtual async Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken = default)
{ {
if (scope == null) if (scope == null)
{ {
@ -89,7 +89,7 @@ namespace OpenIddict.Core
try try
{ {
return await Store.CreateAsync(scope, cancellationToken); await Store.CreateAsync(scope, cancellationToken);
} }
catch (Exception exception) catch (Exception exception)
@ -123,7 +123,9 @@ namespace OpenIddict.Core
} }
await PopulateAsync(scope, descriptor, cancellationToken); await PopulateAsync(scope, descriptor, cancellationToken);
return await CreateAsync(scope, cancellationToken); await CreateAsync(scope, cancellationToken);
return scope;
} }
/// <summary> /// <summary>

10
src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs

@ -80,9 +80,9 @@ namespace OpenIddict.Core
/// <param name="token">The token.</param> /// <param name="token">The token.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the token. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public virtual async Task<TToken> CreateAsync([NotNull] TToken token, CancellationToken cancellationToken = default) public virtual async Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken = default)
{ {
if (token == null) if (token == null)
{ {
@ -93,7 +93,7 @@ namespace OpenIddict.Core
try try
{ {
return await Store.CreateAsync(token, cancellationToken); await Store.CreateAsync(token, cancellationToken);
} }
catch (Exception exception) catch (Exception exception)
@ -127,7 +127,9 @@ namespace OpenIddict.Core
} }
await PopulateAsync(token, descriptor, cancellationToken); await PopulateAsync(token, descriptor, cancellationToken);
return await CreateAsync(token, cancellationToken); await CreateAsync(token, cancellationToken);
return token;
} }
/// <summary> /// <summary>

4
src/OpenIddict.Core/Stores/IOpenIddictApplicationStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <param name="application">The application to create.</param> /// <param name="application">The application to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the application. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes an existing application. /// Removes an existing application.

4
src/OpenIddict.Core/Stores/IOpenIddictAuthorizationStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <param name="authorization">The authorization to create.</param> /// <param name="authorization">The authorization to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the authorization. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
Task<TAuthorization> CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes an existing authorization. /// Removes an existing authorization.

4
src/OpenIddict.Core/Stores/IOpenIddictScopeStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <param name="scope">The scope to create.</param> /// <param name="scope">The scope to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the scope. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
Task<TScope> CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes an existing scope. /// Removes an existing scope.

4
src/OpenIddict.Core/Stores/IOpenIddictTokenStore.cs

@ -48,9 +48,9 @@ namespace OpenIddict.Core
/// <param name="token">The token to create.</param> /// <param name="token">The token to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the token. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
Task<TToken> CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes a token. /// Removes a token.

4
src/OpenIddict.Core/Stores/OpenIddictApplicationStore.cs

@ -62,9 +62,9 @@ namespace OpenIddict.Core
/// <param name="application">The application to create.</param> /// <param name="application">The application to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the application. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public abstract Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken); public abstract Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes an existing application. /// Removes an existing application.

4
src/OpenIddict.Core/Stores/OpenIddictAuthorizationStore.cs

@ -63,9 +63,9 @@ namespace OpenIddict.Core
/// <param name="authorization">The authorization to create.</param> /// <param name="authorization">The authorization to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the authorization. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public abstract Task<TAuthorization> CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken); public abstract Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes an existing authorization. /// Removes an existing authorization.

4
src/OpenIddict.Core/Stores/OpenIddictScopeStore.cs

@ -58,9 +58,9 @@ namespace OpenIddict.Core
/// <param name="scope">The scope to create.</param> /// <param name="scope">The scope to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the scope. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public abstract Task<TScope> CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken); public abstract Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes an existing scope. /// Removes an existing scope.

4
src/OpenIddict.Core/Stores/OpenIddictTokenStore.cs

@ -62,9 +62,9 @@ namespace OpenIddict.Core
/// <param name="token">The token to create.</param> /// <param name="token">The token to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the token. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public abstract Task<TToken> CreateAsync([NotNull] TToken token, CancellationToken cancellationToken); public abstract Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken);
/// <summary> /// <summary>
/// Removes a token. /// Removes a token.

8
src/OpenIddict.EntityFramework/Stores/OpenIddictApplicationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework
/// <param name="application">The application to create.</param> /// <param name="application">The application to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the application. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{ {
if (application == null) if (application == null)
{ {
@ -129,9 +129,7 @@ namespace OpenIddict.EntityFramework
Applications.Add(application); Applications.Add(application);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return application;
} }
/// <summary> /// <summary>

8
src/OpenIddict.EntityFramework/Stores/OpenIddictAuthorizationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFramework
/// <param name="authorization">The authorization to create.</param> /// <param name="authorization">The authorization to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the authorization. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TAuthorization> CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{ {
if (authorization == null) if (authorization == null)
{ {
@ -129,9 +129,7 @@ namespace OpenIddict.EntityFramework
Authorizations.Add(authorization); Authorizations.Add(authorization);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return authorization;
} }
/// <summary> /// <summary>

8
src/OpenIddict.EntityFramework/Stores/OpenIddictScopeStore.cs

@ -98,9 +98,9 @@ namespace OpenIddict.EntityFramework
/// <param name="scope">The scope to create.</param> /// <param name="scope">The scope to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the scope. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TScope> CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken)
{ {
if (scope == null) if (scope == null)
{ {
@ -109,9 +109,7 @@ namespace OpenIddict.EntityFramework
Scopes.Add(scope); Scopes.Add(scope);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return scope;
} }
/// <summary> /// <summary>

8
src/OpenIddict.EntityFramework/Stores/OpenIddictTokenStore.cs

@ -117,9 +117,9 @@ namespace OpenIddict.EntityFramework
/// <param name="token">The token to create.</param> /// <param name="token">The token to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the token. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TToken> CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken)
{ {
if (token == null) if (token == null)
{ {
@ -128,9 +128,7 @@ namespace OpenIddict.EntityFramework
Tokens.Add(token); Tokens.Add(token);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return token;
} }
/// <summary> /// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <param name="application">The application to create.</param> /// <param name="application">The application to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the application. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TApplication> CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TApplication application, CancellationToken cancellationToken)
{ {
if (application == null) if (application == null)
{ {
@ -129,9 +129,7 @@ namespace OpenIddict.EntityFrameworkCore
Context.Add(application); Context.Add(application);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return application;
} }
/// <summary> /// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs

@ -118,9 +118,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <param name="authorization">The authorization to create.</param> /// <param name="authorization">The authorization to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the authorization. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TAuthorization> CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken)
{ {
if (authorization == null) if (authorization == null)
{ {
@ -129,9 +129,7 @@ namespace OpenIddict.EntityFrameworkCore
Context.Add(authorization); Context.Add(authorization);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return authorization;
} }
/// <summary> /// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictScopeStore.cs

@ -98,9 +98,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <param name="scope">The scope to create.</param> /// <param name="scope">The scope to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the scope. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TScope> CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TScope scope, CancellationToken cancellationToken)
{ {
if (scope == null) if (scope == null)
{ {
@ -109,9 +109,7 @@ namespace OpenIddict.EntityFrameworkCore
Scopes.Add(scope); Scopes.Add(scope);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return scope;
} }
/// <summary> /// <summary>

8
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictTokenStore.cs

@ -117,9 +117,9 @@ namespace OpenIddict.EntityFrameworkCore
/// <param name="token">The token to create.</param> /// <param name="token">The token to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> that can be used to abort the operation.</param>
/// <returns> /// <returns>
/// A <see cref="Task"/> that can be used to monitor the asynchronous operation, whose result returns the token. /// A <see cref="Task"/> that can be used to monitor the asynchronous operation.
/// </returns> /// </returns>
public override async Task<TToken> CreateAsync([NotNull] TToken token, CancellationToken cancellationToken) public override Task CreateAsync([NotNull] TToken token, CancellationToken cancellationToken)
{ {
if (token == null) if (token == null)
{ {
@ -128,9 +128,7 @@ namespace OpenIddict.EntityFrameworkCore
Context.Add(token); Context.Add(token);
await Context.SaveChangesAsync(cancellationToken); return Context.SaveChangesAsync(cancellationToken);
return token;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save