MVC5 ApplicationUser custom properties

前端 未结 3 1778
野的像风
野的像风 2021-01-01 01:55

I am trying to get to grips with the new Membership system introduced in ASP.NET MVC 5 and I\'ve come across a small issue which I am pretty sure you will be able to help me

3条回答
  •  灰色年华
    2021-01-01 02:43

    When we used the Users object of our database context we ran into other tracking errors. In our application, we would retrieve users as such

    var user = UserManager.FindById(userId);
    

    Edit the properties:

    user.StorageName = "gooblygook";
    //whatever other properties you would like to use
    

    And then we would save it with the UserManager in the controller:

    UserManager.Update(user);
    

    This is currently a working solution for us.

提交回复
热议问题