From 2cd7ca4f6c03b8021a745ad1ba56b97b1c9004dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sat, 17 Feb 2018 04:30:25 +0100 Subject: [PATCH 1/2] Update version.props to build 2.0.0-rc2-final packages --- build/version.props | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/version.props b/build/version.props index 222e29c6..a90a8b6a 100644 --- a/build/version.props +++ b/build/version.props @@ -1,9 +1,7 @@ - 2.0.0 - rc2 - $(VersionSuffix)-$(BuildNumber) + 2.0.0-rc2-final From 57676d76130a50297fc4a7d05ce853a7562ac54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sat, 17 Feb 2018 14:37:49 +0100 Subject: [PATCH 2/2] Update OpenIddictApplicationStore/OpenIddictAuthorizationStore.DeleteAsync() to work around an Entity Framework Core bug --- .../Stores/OpenIddictApplicationStore.cs | 16 ++++++++++++++-- .../Stores/OpenIddictAuthorizationStore.cs | 8 +++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs index 90e723f3..fafc3ff1 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictApplicationStore.cs @@ -161,14 +161,26 @@ namespace OpenIddict.EntityFrameworkCore throw new ArgumentNullException(nameof(application)); } + // Note: due to a bug in Entity Framework Core's query visitor, the authorizations can't be + // filtered using authorization.Application.Id.Equals(key). To work around this issue, + // this local method uses an explicit join before applying the equality check. + // See https://github.com/openiddict/openiddict-core/issues/499 for more information. + Task> ListAuthorizationsAsync() => (from authorization in Authorizations.Include(authorization => authorization.Tokens) - where authorization.Application.Id.Equals(application.Id) + join element in Applications on authorization.Application.Id equals element.Id + where element.Id.Equals(application.Id) select authorization).ToListAsync(cancellationToken); + // Note: due to a bug in Entity Framework Core's query visitor, the tokens can't be + // filtered using token.Application.Id.Equals(key). To work around this issue, + // this local method uses an explicit join before applying the equality check. + // See https://github.com/openiddict/openiddict-core/issues/499 for more information. + Task> ListTokensAsync() => (from token in Tokens - where token.Application.Id.Equals(application.Id) + join element in Applications on token.Application.Id equals element.Id + where element.Id.Equals(application.Id) select token).ToListAsync(cancellationToken); // Remove all the authorizations associated with the application and diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs index 08b5c809..8191ebfe 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictAuthorizationStore.cs @@ -161,9 +161,15 @@ namespace OpenIddict.EntityFrameworkCore throw new ArgumentNullException(nameof(authorization)); } + // Note: due to a bug in Entity Framework Core's query visitor, the tokens can't be + // filtered using token.Application.Id.Equals(key). To work around this issue, + // this local method uses an explicit join before applying the equality check. + // See https://github.com/openiddict/openiddict-core/issues/499 for more information. + Task> ListTokensAsync() => (from token in Tokens - where token.Authorization.Id.Equals(authorization.Id) + join element in Authorizations on token.Authorization.Id equals element.Id + where element.Id.Equals(authorization.Id) select token).ToListAsync(cancellationToken); // Remove all the tokens associated with the application.