From 0cd3f48bb9c1c0024d9212ad4b61c0f99186a13f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Mon, 20 Jul 2026 19:36:42 +0200 Subject: [PATCH] Use HasIndex() overload accepting an expression tree --- .../OpenIddictEntityFrameworkCoreApplicationConfiguration.cs | 5 +---- .../OpenIddictEntityFrameworkCoreResourceConfiguration.cs | 5 +---- .../OpenIddictEntityFrameworkCoreScopeConfiguration.cs | 5 +---- .../OpenIddictEntityFrameworkCoreTokenConfiguration.cs | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreApplicationConfiguration.cs b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreApplicationConfiguration.cs index a2fe346e..399ea5f8 100644 --- a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreApplicationConfiguration.cs +++ b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreApplicationConfiguration.cs @@ -42,10 +42,7 @@ public sealed class OpenIddictEntityFrameworkCoreApplicationConfiguration< builder.Property(static application => application.ApplicationType) .HasMaxLength(50); - // Warning: the non-generic overlord is deliberately used to work around - // a breaking change introduced in Entity Framework Core 3.x (where a - // generic entity type builder is now returned by the HasIndex() method). - builder.HasIndex(nameof(OpenIddictEntityFrameworkCoreApplication.ClientId)) + builder.HasIndex(static application => application.ClientId) .IsUnique(); builder.Property(static application => application.ClientId) diff --git a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreResourceConfiguration.cs b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreResourceConfiguration.cs index 71783fd2..70636ec1 100644 --- a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreResourceConfiguration.cs +++ b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreResourceConfiguration.cs @@ -33,10 +33,7 @@ public sealed class OpenIddictEntityFrameworkCoreResourceConfiguration< builder.HasKey(static resource => resource.Id); - // Warning: the non-generic overlord is deliberately used to work around - // a breaking change introduced in Entity Framework Core 3.x (where a - // generic entity type builder is now returned by the HasIndex() method). - builder.HasIndex(nameof(OpenIddictEntityFrameworkCoreResource.Name)) + builder.HasIndex(static resource => resource.Name) .IsUnique(); builder.Property(static resource => resource.ConcurrencyToken) diff --git a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreScopeConfiguration.cs b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreScopeConfiguration.cs index e0c43f2d..98ed324f 100644 --- a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreScopeConfiguration.cs +++ b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreScopeConfiguration.cs @@ -33,10 +33,7 @@ public sealed class OpenIddictEntityFrameworkCoreScopeConfiguration< builder.HasKey(static scope => scope.Id); - // Warning: the non-generic overlord is deliberately used to work around - // a breaking change introduced in Entity Framework Core 3.x (where a - // generic entity type builder is now returned by the HasIndex() method). - builder.HasIndex(nameof(OpenIddictEntityFrameworkCoreScope.Name)) + builder.HasIndex(static scope => scope.Name) .IsUnique(); builder.Property(static scope => scope.ConcurrencyToken) diff --git a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreTokenConfiguration.cs b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreTokenConfiguration.cs index 163f0079..775c1fab 100644 --- a/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreTokenConfiguration.cs +++ b/src/OpenIddict.EntityFrameworkCore/Configurations/OpenIddictEntityFrameworkCoreTokenConfiguration.cs @@ -39,10 +39,7 @@ public sealed class OpenIddictEntityFrameworkCoreTokenConfiguration< builder.HasKey(static token => token.Id); - // Warning: the non-generic overlord is deliberately used to work around - // a breaking change introduced in Entity Framework Core 3.x (where a - // generic entity type builder is now returned by the HasIndex() method). - builder.HasIndex(nameof(OpenIddictEntityFrameworkCoreToken.ReferenceId)) + builder.HasIndex(static token => token.ReferenceId) .IsUnique(); builder.HasIndex(