Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Pass in DbContextOptions to *.IdentityDbContext for all version of IdentityDbContext <> #652

Closed
SychevIgor opened this issue Nov 27, 2015 · 3 comments
Assignees
Milestone

Comments

@SychevIgor
Copy link

We need to configure dbcontext as it mentioned here: https://github.com/aspnet/EntityFramework/wiki/Configuring-a-DbContext

It's cool that we make it possible to pass DbContextOptions via constructor for this class:

  public class IdentityDbContext<TUser, TRole, TKey> : DbContext
        where TUser : IdentityUser<TKey>
        where TRole : IdentityRole<TKey>
        where TKey : IEquatable<TKey>

#570
#418

But for 2 others we still can't do it without modifications of our context:

    /// <summary>
    /// Base class for the Entity Framework database context used for identity.
    /// </summary>
    public class IdentityDbContext : IdentityDbContext<IdentityUser, IdentityRole, string> { }

    /// <summary>
    /// Base class for the Entity Framework database context used for identity.
    /// </summary>
    /// <typeparam name="TUser">The type of the user objects.</typeparam>
    public class IdentityDbContext<TUser> : IdentityDbContext<TUser, IdentityRole, string> where 
        TUser : IdentityUser { }

As a result you are forcing us to inherit our dbcontext from IdentityDbContext : IdentityDbContext<IdentityUser, IdentityRole, string> and making the other 2 others versions IdentityDbContext<TUser>, IdentityDbContext completely useless.

@SychevIgor
Copy link
Author

Looks like somebody already propose this changes #643 and I hope that team will get it to a project.

@SychevIgor SychevIgor reopened this Nov 27, 2015
@rustd rustd added this to the 3.0.0-rc2 milestone Nov 30, 2015
@divega divega assigned HaoK and unassigned divega Feb 3, 2016
@divega
Copy link

divega commented Feb 3, 2016

@HaoK @rustd I just looked at this bug and I agree we should just add the constructors to all the versions of IdentityDbContext to take the same parameters as the base. I am assigning it to @HaoK.

@HaoK
Copy link
Member

HaoK commented Feb 4, 2016

ada5756

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants