Add constructors to IdentityDbContext to allow dependency injection. The other approach (overriding 'OnConfiguring') does not work well with unit testing.
This commit is contained in:
parent
360a06004b
commit
eadcae54d4
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
|
using Microsoft.Data.Entity.Infrastructure;
|
||||||
using Microsoft.Data.Entity.Metadata;
|
using Microsoft.Data.Entity.Metadata;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Identity.EntityFramework
|
namespace Microsoft.AspNet.Identity.EntityFramework
|
||||||
|
|
@ -17,6 +18,26 @@ namespace Microsoft.AspNet.Identity.EntityFramework
|
||||||
where TRole : IdentityRole<TKey>
|
where TRole : IdentityRole<TKey>
|
||||||
where TKey : IEquatable<TKey>
|
where TKey : IEquatable<TKey>
|
||||||
{
|
{
|
||||||
|
public IdentityDbContext(DbContextOptions options) : base(options)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IdentityDbContext(IServiceProvider serviceProvider) : base(serviceProvider)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IdentityDbContext(IServiceProvider serviceProvider, DbContextOptions options) : base(serviceProvider, options)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IdentityDbContext()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public DbSet<TUser> Users { get; set; }
|
public DbSet<TUser> Users { get; set; }
|
||||||
public DbSet<IdentityUserClaim<TKey>> UserClaims { get; set; }
|
public DbSet<IdentityUserClaim<TKey>> UserClaims { get; set; }
|
||||||
public DbSet<IdentityUserLogin<TKey>> UserLogins { get; set; }
|
public DbSet<IdentityUserLogin<TKey>> UserLogins { get; set; }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue