Browse Source

React to API changes in aspnet/Identity and aspnet/EntityFramework

c068128098

5fba08562f

91aff89a3c
pull/73/head
Kévin Chalet 10 years ago
parent
commit
24b167b952
  1. 3
      samples/Mvc.Server/Models/ApplicationDbContext.cs
  2. 3
      samples/Mvc.Server/Startup.cs
  3. 25
      src/OpenIddict.EF/OpenIddictContext.cs

3
samples/Mvc.Server/Models/ApplicationDbContext.cs

@ -3,6 +3,9 @@ using OpenIddict;
namespace Mvc.Server.Models {
public class ApplicationDbContext : OpenIddictContext<ApplicationUser> {
public ApplicationDbContext(DbContextOptions options)
: base(options) { }
protected override void OnModelCreating(ModelBuilder builder) {
base.OnModelCreating(builder);

3
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<ApplicationDbContext>(options =>
options.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"]));

25
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<TKey>
where TRole : IdentityRole<TKey>
where TKey : IEquatable<TKey> {
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<TApplication> Applications { get; set; }
}
public class OpenIddictContext<TUser> : OpenIddictContext<TUser, Application, IdentityRole, string> 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<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) { }
}
}
Loading…
Cancel
Save