Browse Source

Remove the Enumerable.Contains() workaround from the Entity Framework Core stores

pull/2514/head
Kévin Chalet 2 months ago
parent
commit
03f8f3ff3c
  1. 9
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreResourceStore.cs
  2. 9
      src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs

9
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreResourceStore.cs

@ -174,11 +174,10 @@ public class OpenIddictEntityFrameworkCoreResourceStore<
{
var context = await Context.GetDbContextAsync(cancellationToken);
// Note: Enumerable.Contains() is deliberately used without the extension method syntax to ensure
// ImmutableArray.Contains() (which is not fully supported by Entity Framework Core) is not used instead.
await foreach (var resource in (from resource in context.Set<TResource>().AsTracking()
where Enumerable.Contains(names, resource.Name)
select resource).AsAsyncEnumerable().WithCancellation(cancellationToken))
await foreach (var resource in (
from resource in context.Set<TResource>().AsTracking()
where names.Contains(resource.Name!)
select resource).AsAsyncEnumerable().WithCancellation(cancellationToken))
{
yield return resource;
}

9
src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs

@ -174,11 +174,10 @@ public class OpenIddictEntityFrameworkCoreScopeStore<
{
var context = await Context.GetDbContextAsync(cancellationToken);
// Note: Enumerable.Contains() is deliberately used without the extension method syntax to ensure
// ImmutableArray.Contains() (which is not fully supported by Entity Framework Core) is not used instead.
await foreach (var scope in (from scope in context.Set<TScope>().AsTracking()
where Enumerable.Contains(names, scope.Name)
select scope).AsAsyncEnumerable().WithCancellation(cancellationToken))
await foreach (var scope in (
from scope in context.Set<TScope>().AsTracking()
where names.Contains(scope.Name!)
select scope).AsAsyncEnumerable().WithCancellation(cancellationToken))
{
yield return scope;
}

Loading…
Cancel
Save