I am using the built in identity framework for user management, and would like to add a few customizations to the AspNetUsers table. So far the solution to each problem I\'ve en
I faced the same problem. An easy way to overcome this was just to take the properties I wanted to update from the model and save them back to an object pulled from the UserManager;
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(ApplicationUser model)
{
if (ModelState.IsValid)
{
ApplicationUser u = UserManager.FindById(model.Id);
u.UserName = model.Email;
u.Email = model.Email;
u.StaffName = model.StaffName; // Extra Property
UserManager.Update(u);
return RedirectToAction("Index");
}
return View(model);
}
So, you are using database-first instead of code-first. My recommendation is to use code-first. I, like you, started out using database first, instead. If you aren't using code-first, then delete the migrations table in your database. Otherwise, it will cause problems.
If possible, I recommend following this code-first tutorial, which has helped me greatly. You can easily add custom fields to your identity and have full integration with the framework as far as authentication goes.
http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates.aspx