Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>They made it easy to modify the profile with SimpleMembership. SimpleMembership is using the code first EF model and the user profile is defined in the file AccountModels.cs that is generated as part of the Internet template for MVC 4. Just modify the class UserProfile and add the new fields in the class definition. For example, adding a field for email would look something like this:</p> <pre><code>[Table("UserProfile")] public class UserProfile { [Key] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int UserId { get; set; } public string UserName { get; set; } public string Email { get; set; } } </code></pre> <p>Here is an example on how you would access the email field:</p> <pre><code>var context = new UsersContext(); var username = User.Identity.Name; var user = context.UserProfiles.SingleOrDefault(u =&gt; u.UserName == username); var email = user.Email; </code></pre> <p>Here is what the database looks like after adding the email field.</p> <p><img src="https://i.stack.imgur.com/74H9a.jpg" alt="enter image description here"></p> <p>There is a good blog that describes some of the <a href="http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx" rel="nofollow noreferrer">changes in SimpleMembership here</a>. You can also find more detailed information on <a href="http://kevin-junghans.blogspot.com/2013/01/seeding-customizing-aspnet-mvc.html" rel="nofollow noreferrer">customizing and seeding SimpleMembership here</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload