diff --git a/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs b/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs index fddd7dc6..60f179b9 100644 --- a/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs +++ b/src/OpenIddict.EntityFrameworkCore/OpenIddictEntityFrameworkCoreHelpers.cs @@ -29,7 +29,20 @@ public static class OpenIddictEntityFrameworkCoreHelpers OpenIddictEntityFrameworkCoreToken, string>(); /// - /// Registers the OpenIddict entity sets in the Entity Framework Core + /// Registers the OpenIddict entity sets in the Entity Framework Core context + /// using the default OpenIddict models and the default key type (string). + /// + /// The builder used to configure the Entity Framework context. + /// The Entity Framework context builder. + public static DbContextOptionsBuilder UseOpenIddict(this DbContextOptionsBuilder builder) + where TContext : DbContext + { + ((DbContextOptionsBuilder) builder).UseOpenIddict(); + return builder; + } + + /// + /// Registers the OpenIddict entity sets in the Entity Framework Core /// context using the default OpenIddict models and the specified key type. /// /// @@ -45,6 +58,24 @@ public static class OpenIddictEntityFrameworkCoreHelpers OpenIddictEntityFrameworkCoreScope, OpenIddictEntityFrameworkCoreToken, TKey>(); + /// + /// Registers the OpenIddict entity sets in the Entity Framework Core + /// context using the default OpenIddict models and the specified key type. + /// + /// + /// Note: when using a custom key type, the new key type MUST be registered by calling + /// . + /// + /// The builder used to configure the Entity Framework context. + /// The Entity Framework context builder. + public static DbContextOptionsBuilder UseOpenIddict(this DbContextOptionsBuilder builder) + where TKey : notnull, IEquatable + where TContext : DbContext + { + builder.UseOpenIddict(); + return builder; + } + /// /// Registers the OpenIddict entity sets in the Entity Framework Core /// context using the specified entities and the specified key type. @@ -72,6 +103,29 @@ public static class OpenIddictEntityFrameworkCoreHelpers TApplication, TAuthorization, TScope, TToken, TKey>>(); } + /// + /// Registers the OpenIddict entity sets in the Entity Framework Core + /// context using the specified entities and the specified key type. + /// + /// + /// Note: when using custom entities, the new entities MUST be registered by calling + /// . + /// + /// The builder used to configure the Entity Framework context. + /// The Entity Framework context builder. + public static DbContextOptionsBuilder UseOpenIddict( + this DbContextOptionsBuilder builder) + where TApplication : OpenIddictEntityFrameworkCoreApplication + where TAuthorization : OpenIddictEntityFrameworkCoreAuthorization + where TScope : OpenIddictEntityFrameworkCoreScope + where TToken : OpenIddictEntityFrameworkCoreToken + where TKey : notnull, IEquatable + where TContext : DbContext + { + builder.UseOpenIddict(); + return builder; + } + /// /// Registers the OpenIddict entity sets in the Entity Framework Core context /// using the default OpenIddict models and the default key type (string).