From f11b4fdb4e3bcc66d59135602505dc0161da0a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Sat, 6 Jan 2018 03:48:26 +0100 Subject: [PATCH] Remove the generic OpenIddictExtension class --- .../OpenIddictExtension.cs | 42 ------------------- .../OpenIddictExtensions.cs | 5 +-- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 src/OpenIddict.EntityFrameworkCore/OpenIddictExtension.cs diff --git a/src/OpenIddict.EntityFrameworkCore/OpenIddictExtension.cs b/src/OpenIddict.EntityFrameworkCore/OpenIddictExtension.cs deleted file mode 100644 index 93aa71d7..00000000 --- a/src/OpenIddict.EntityFrameworkCore/OpenIddictExtension.cs +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) - * See https://github.com/openiddict/openiddict-core for more information concerning - * the license and the contributors participating to this project. - */ - -using System; -using JetBrains.Annotations; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.Extensions.DependencyInjection; -using OpenIddict.Models; - -namespace OpenIddict.EntityFrameworkCore -{ - public class OpenIddictExtension : IDbContextOptionsExtension - where TApplication : OpenIddictApplication, new() - where TAuthorization : OpenIddictAuthorization, new() - where TScope : OpenIddictScope, new() - where TToken : OpenIddictToken, new() - where TKey : IEquatable - { - public string LogFragment => null; - - public bool ApplyServices([NotNull] IServiceCollection services) - { - if (services == null) - { - throw new ArgumentNullException(nameof(services)); - } - - services.AddSingleton>(); - - // Return false to indicate that no database - // provider was registered by this extension. - return false; - } - - public long GetServiceProviderHashCode() => 0; - - public void Validate([NotNull] IDbContextOptions options) { } - } -} diff --git a/src/OpenIddict.EntityFrameworkCore/OpenIddictExtensions.cs b/src/OpenIddict.EntityFrameworkCore/OpenIddictExtensions.cs index b01d996b..31cb2804 100644 --- a/src/OpenIddict.EntityFrameworkCore/OpenIddictExtensions.cs +++ b/src/OpenIddict.EntityFrameworkCore/OpenIddictExtensions.cs @@ -161,10 +161,7 @@ namespace Microsoft.Extensions.DependencyInjection throw new ArgumentNullException(nameof(builder)); } - var extension = new OpenIddictExtension(); - ((IDbContextOptionsBuilderInfrastructure) builder).AddOrUpdateExtension(extension); - - return builder; + return builder.ReplaceService>(); } ///