diff --git a/Packages.props b/Packages.props
index c77e17a3..1e98a9f2 100644
--- a/Packages.props
+++ b/Packages.props
@@ -5,15 +5,15 @@
-
+
-
-
-
+
+
+
@@ -22,7 +22,7 @@
-
+
-
-
+
+
@@ -52,22 +52,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eng/CodeAnalysis.ruleset b/eng/CodeAnalysis.ruleset
index 3df93190..c4ce0577 100644
--- a/eng/CodeAnalysis.ruleset
+++ b/eng/CodeAnalysis.ruleset
@@ -99,6 +99,7 @@
+
diff --git a/global.json b/global.json
index 0a08cf8e..e148f156 100644
--- a/global.json
+++ b/global.json
@@ -1,11 +1,11 @@
{
"tools": {
- "dotnet": "5.0.100-preview.8.20417.9",
+ "dotnet": "5.0.100-rc.2.20479.15",
"runtimes": {
"aspnetcore": [
- "2.1.22",
- "3.1.8"
+ "2.1.23",
+ "3.1.9"
]
}
},
diff --git a/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs b/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs
index 2d99d45c..988917f8 100644
--- a/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs
+++ b/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs
@@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
+using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
using OpenIddict.EntityFrameworkCore;
@@ -134,7 +135,15 @@ namespace Microsoft.EntityFrameworkCore
.ApplyConfiguration(new OpenIddictEntityFrameworkCoreTokenConfiguration());
}
-#if !SUPPORTS_BCL_ASYNC_ENUMERABLE
+#if SUPPORTS_BCL_ASYNC_ENUMERABLE
+ ///
+ /// Executes the query and returns the results as a streamed async enumeration.
+ ///
+ /// The type of the returned entities.
+ /// The query source.
+ /// The that can be used to abort the operation.
+ /// The non-streamed async enumeration containing the results.
+#else
///
/// Executes the query and returns the results as a non-streamed async enumeration.
///
@@ -142,8 +151,8 @@ namespace Microsoft.EntityFrameworkCore
/// The query source.
/// The that can be used to abort the operation.
/// The non-streamed async enumeration containing the results.
- internal static IAsyncEnumerable AsAsyncEnumerable(
- this IQueryable source, CancellationToken cancellationToken = default)
+#endif
+ internal static IAsyncEnumerable AsAsyncEnumerable(this IQueryable source, CancellationToken cancellationToken)
{
if (source is null)
{
@@ -154,12 +163,18 @@ namespace Microsoft.EntityFrameworkCore
static async IAsyncEnumerable ExecuteAsync(IQueryable source, [EnumeratorCancellation] CancellationToken cancellationToken)
{
+#if SUPPORTS_BCL_ASYNC_ENUMERABLE
+ await foreach (var element in source.AsAsyncEnumerable().WithCancellation(cancellationToken))
+ {
+ yield return element;
+ }
+#else
foreach (var element in await source.ToListAsync(cancellationToken))
{
yield return element;
}
+#endif
}
}
-#endif
}
}
\ No newline at end of file
diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs
index 289d670b..be6e82ca 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs
@@ -307,7 +307,7 @@ namespace OpenIddict.EntityFrameworkCore
{
var applications = (from application in Applications.AsTracking()
where application.PostLogoutRedirectUris!.Contains(address)
- select application).AsAsyncEnumerable();
+ select application).AsAsyncEnumerable(cancellationToken);
await foreach (var application in applications)
{
@@ -341,7 +341,7 @@ namespace OpenIddict.EntityFrameworkCore
{
var applications = (from application in Applications.AsTracking()
where application.RedirectUris!.Contains(address)
- select application).AsAsyncEnumerable();
+ select application).AsAsyncEnumerable(cancellationToken);
await foreach (var application in applications)
{
@@ -673,7 +673,7 @@ namespace OpenIddict.EntityFrameworkCore
query = query.Take(count.Value);
}
- return query.AsAsyncEnumerable();
+ return query.AsAsyncEnumerable(cancellationToken);
}
///
@@ -686,7 +686,7 @@ namespace OpenIddict.EntityFrameworkCore
throw new ArgumentNullException(nameof(query));
}
- return query(Applications.AsTracking(), state).AsAsyncEnumerable();
+ return query(Applications.AsTracking(), state).AsAsyncEnumerable(cancellationToken);
}
///
diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs
index bcb0a113..3b25725e 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs
@@ -253,7 +253,7 @@ namespace OpenIddict.EntityFrameworkCore
where authorization.Subject == subject
join application in Applications.AsTracking() on authorization.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select authorization).AsAsyncEnumerable();
+ select authorization).AsAsyncEnumerable(cancellationToken);
}
///
@@ -287,7 +287,7 @@ namespace OpenIddict.EntityFrameworkCore
where authorization.Subject == subject && authorization.Status == status
join application in Applications.AsTracking() on authorization.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select authorization).AsAsyncEnumerable();
+ select authorization).AsAsyncEnumerable(cancellationToken);
}
///
@@ -328,7 +328,7 @@ namespace OpenIddict.EntityFrameworkCore
authorization.Type == type
join application in Applications.AsTracking() on authorization.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select authorization).AsAsyncEnumerable();
+ select authorization).AsAsyncEnumerable(cancellationToken);
}
///
@@ -374,7 +374,7 @@ namespace OpenIddict.EntityFrameworkCore
authorization.Type == type
join application in Applications.AsTracking() on authorization.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select authorization).AsAsyncEnumerable();
+ select authorization).AsAsyncEnumerable(cancellationToken);
await foreach (var authorization in authorizations)
{
@@ -405,7 +405,7 @@ namespace OpenIddict.EntityFrameworkCore
return (from authorization in Authorizations.Include(authorization => authorization.Application).AsTracking()
join application in Applications.AsTracking() on authorization.Application!.Id equals application.Id
where application.Id!.Equals(identifier)
- select authorization).AsAsyncEnumerable();
+ select authorization).AsAsyncEnumerable(cancellationToken);
}
///
@@ -434,7 +434,7 @@ namespace OpenIddict.EntityFrameworkCore
return (from authorization in Authorizations.Include(authorization => authorization.Application).AsTracking()
where authorization.Subject == subject
- select authorization).AsAsyncEnumerable();
+ select authorization).AsAsyncEnumerable(cancellationToken);
}
///
@@ -642,7 +642,7 @@ namespace OpenIddict.EntityFrameworkCore
query = query.Take(count.Value);
}
- return query.AsAsyncEnumerable();
+ return query.AsAsyncEnumerable(cancellationToken);
}
///
@@ -657,7 +657,7 @@ namespace OpenIddict.EntityFrameworkCore
return query(
Authorizations.Include(authorization => authorization.Application)
- .AsTracking(), state).AsAsyncEnumerable();
+ .AsTracking(), state).AsAsyncEnumerable(cancellationToken);
}
///
diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs
index 9c94efc3..57513223 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs
@@ -194,7 +194,7 @@ namespace OpenIddict.EntityFrameworkCore
// ImmutableArray.Contains() (which is not fully supported by Entity Framework Core) is not used instead.
return (from scope in Scopes.AsTracking()
where Enumerable.Contains(names, scope.Name)
- select scope).AsAsyncEnumerable();
+ select scope).AsAsyncEnumerable(cancellationToken);
}
///
@@ -218,7 +218,7 @@ namespace OpenIddict.EntityFrameworkCore
{
var scopes = (from scope in Scopes.AsTracking()
where scope.Resources!.Contains(resource)
- select scope).AsAsyncEnumerable();
+ select scope).AsAsyncEnumerable(cancellationToken);
await foreach (var scope in scopes)
{
@@ -458,7 +458,7 @@ namespace OpenIddict.EntityFrameworkCore
query = query.Take(count.Value);
}
- return query.AsAsyncEnumerable();
+ return query.AsAsyncEnumerable(cancellationToken);
}
///
@@ -471,7 +471,7 @@ namespace OpenIddict.EntityFrameworkCore
throw new ArgumentNullException(nameof(query));
}
- return query(Scopes.AsTracking(), state).AsAsyncEnumerable();
+ return query(Scopes.AsTracking(), state).AsAsyncEnumerable(cancellationToken);
}
///
diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs
index a22dba43..b14ac2c0 100644
--- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs
+++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs
@@ -199,7 +199,7 @@ namespace OpenIddict.EntityFrameworkCore
where token.Subject == subject
join application in Applications.AsTracking() on token.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select token).AsAsyncEnumerable();
+ select token).AsAsyncEnumerable(cancellationToken);
}
///
@@ -234,7 +234,7 @@ namespace OpenIddict.EntityFrameworkCore
token.Status == status
join application in Applications.AsTracking() on token.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select token).AsAsyncEnumerable();
+ select token).AsAsyncEnumerable(cancellationToken);
}
///
@@ -275,7 +275,7 @@ namespace OpenIddict.EntityFrameworkCore
token.Type == type
join application in Applications.AsTracking() on token.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select token).AsAsyncEnumerable();
+ select token).AsAsyncEnumerable(cancellationToken);
}
///
@@ -296,7 +296,7 @@ namespace OpenIddict.EntityFrameworkCore
return (from token in Tokens.Include(token => token.Application).Include(token => token.Authorization).AsTracking()
join application in Applications.AsTracking() on token.Application!.Id equals application.Id
where application.Id!.Equals(key)
- select token).AsAsyncEnumerable();
+ select token).AsAsyncEnumerable(cancellationToken);
}
///
@@ -317,7 +317,7 @@ namespace OpenIddict.EntityFrameworkCore
return (from token in Tokens.Include(token => token.Application).Include(token => token.Authorization).AsTracking()
join authorization in Authorizations.AsTracking() on token.Authorization!.Id equals authorization.Id
where authorization.Id!.Equals(key)
- select token).AsAsyncEnumerable();
+ select token).AsAsyncEnumerable(cancellationToken);
}
///
@@ -358,7 +358,7 @@ namespace OpenIddict.EntityFrameworkCore
return (from token in Tokens.Include(token => token.Application).Include(token => token.Authorization).AsTracking()
where token.Subject == subject
- select token).AsAsyncEnumerable();
+ select token).AsAsyncEnumerable(cancellationToken);
}
///
@@ -599,7 +599,7 @@ namespace OpenIddict.EntityFrameworkCore
query = query.Take(count.Value);
}
- return query.AsAsyncEnumerable();
+ return query.AsAsyncEnumerable(cancellationToken);
}
///
@@ -615,7 +615,7 @@ namespace OpenIddict.EntityFrameworkCore
return query(
Tokens.Include(token => token.Application)
.Include(token => token.Authorization)
- .AsTracking(), state).AsAsyncEnumerable();
+ .AsTracking(), state).AsAsyncEnumerable(cancellationToken);
}
///