From 24b167b952d9797a1d6d32933dfa7b1fd4351013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Tue, 15 Mar 2016 17:49:40 +0100 Subject: [PATCH] React to API changes in aspnet/Identity and aspnet/EntityFramework https://github.com/aspnet/Identity/commit/c068128098f365f3dc7244b348f82bd0d9413902 https://github.com/aspnet/Identity/commit/5fba08562fa9151c45ea4f4d51a86f232d56dfc7 https://github.com/aspnet/EntityFramework/commit/91aff89a3ca9d5676b41585ab72a9d8aca77e922 --- .../Mvc.Server/Models/ApplicationDbContext.cs | 3 +++ samples/Mvc.Server/Startup.cs | 3 ++- src/OpenIddict.EF/OpenIddictContext.cs | 25 +++---------------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/samples/Mvc.Server/Models/ApplicationDbContext.cs b/samples/Mvc.Server/Models/ApplicationDbContext.cs index b4733b60..4127fc7c 100644 --- a/samples/Mvc.Server/Models/ApplicationDbContext.cs +++ b/samples/Mvc.Server/Models/ApplicationDbContext.cs @@ -3,6 +3,9 @@ using OpenIddict; namespace Mvc.Server.Models { public class ApplicationDbContext : OpenIddictContext { + public ApplicationDbContext(DbContextOptions options) + : base(options) { } + protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); diff --git a/samples/Mvc.Server/Startup.cs b/samples/Mvc.Server/Startup.cs index 3e2e900d..4997daf6 100644 --- a/samples/Mvc.Server/Startup.cs +++ b/samples/Mvc.Server/Startup.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -39,7 +40,7 @@ namespace Mvc.Server { services.AddMvcDnx(); services.AddEntityFramework() - .AddSqlServer() + .AddEntityFrameworkSqlServer() .AddDbContext(options => options.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"])); diff --git a/src/OpenIddict.EF/OpenIddictContext.cs b/src/OpenIddict.EF/OpenIddictContext.cs index a7fee4ab..b80885c0 100644 --- a/src/OpenIddict.EF/OpenIddictContext.cs +++ b/src/OpenIddict.EF/OpenIddictContext.cs @@ -7,7 +7,6 @@ using System; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; using OpenIddict.Models; namespace OpenIddict { @@ -16,43 +15,25 @@ namespace OpenIddict { where TApplication : Application where TRole : IdentityRole where TKey : IEquatable { - public OpenIddictContext() { } + protected OpenIddictContext() { } public OpenIddictContext(DbContextOptions options) : base(options) { } - public OpenIddictContext(IServiceProvider services) - : base(services) { } - - public OpenIddictContext(IServiceProvider services, DbContextOptions options) - : base(services, options) { } - public DbSet Applications { get; set; } } public class OpenIddictContext : OpenIddictContext where TUser : IdentityUser { - public OpenIddictContext() { } + protected OpenIddictContext() { } public OpenIddictContext(DbContextOptions options) : base(options) { } - - public OpenIddictContext(IServiceProvider services) - : base(services) { } - - public OpenIddictContext(IServiceProvider services, DbContextOptions options) - : base(services, options) { } } public class OpenIddictContext : OpenIddictContext { - public OpenIddictContext() { } + protected OpenIddictContext() { } public OpenIddictContext(DbContextOptions options) : base(options) { } - - public OpenIddictContext(IServiceProvider services) - : base(services) { } - - public OpenIddictContext(IServiceProvider services, DbContextOptions options) - : base(services, options) { } } } \ No newline at end of file