samedi 9 mai 2015

custom identity user and extending profile MVC

I am trying to extend the identity user data in separate table but its not populating.

  public class MyUserInfo
  {
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

  }

  public class AppUser : IdentityUser<Int32, AppUserLogin, AppUserRole, AppUserClaim>
  {

    public MyUserInfo MyUserInfo { get; set; }
 }

//Fetching the user data

var userStore = new UserStore<AppUser, AppRole, int, AppUserLogin, AppUserRole, AppUserClaim>(db);
var userManager = new UserManager<AppUser, int>(userStore);

var user = userManager.FindById(1);
**user.MyUserInfo** showing the null. But in db, we have the respective user data.

I saw many post where without customization seems working but for me I modified id stored as integer and changed the table name.

Aucun commentaire:

Enregistrer un commentaire