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

UserStore.Users property should be virtual. #514

Closed
matthewDDennis opened this issue Jul 9, 2015 · 0 comments
Closed

UserStore.Users property should be virtual. #514

matthewDDennis opened this issue Jul 9, 2015 · 0 comments

Comments

@matthewDDennis
Copy link

I'm trying to implement a UserProfile property on my custom User class as shown below.

    public class CodeProjectIdentityUser : IdentityUser<int>
    {
       ...
        public UserProfile UserProfile { get; set; }
    }

I want to load the UserProfile when I load the User from the database.

The simplest thing would be derive a custom user store derived from UserStore

public class CodeProjectUserStore : UserStore<CodeProjectIdentityUser, CodeProjectIdentityRole, CodeProjectIdentityDbContext, int>
{
    public CodeProjectUserStore (CodeProjectIdentityDbContext context, IdentityErrorDescriber describer = null)
        UserStore(context, describer)
    {
    }

    public override IQueryable<CodeProjectUser> Users
    {
        get { return base.Users.Include(u => u.UserProfile); }
    }
}

But unfortunately, the Users property is not virtual, so I will have to implement all the all the methods that use UserStore.Users, and still not have a Users property that returns what I need.

@HaoK HaoK self-assigned this Jul 23, 2015
@HaoK HaoK added this to the 3.0.0-beta7 milestone Jul 23, 2015
@HaoK HaoK closed this as completed in ece1011 Aug 6, 2015
@rustd rustd added 3 - Done and removed 3 - Done labels Aug 24, 2015
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

3 participants