Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>if you look right around line 273 of the <code>accountcontroller</code> you'll find this line </p> <pre><code>db.UserProfiles.Add(new UserProfile { UserName = model.UserName }); </code></pre> <p>Looks like even OOTB they (MS) are doing just as you suggested and using EF to update. </p> <p>I too, am looking for the "correct" way of updating and accessing these properties.</p> <p><strong>Edit:</strong></p> <p>Here's my solution (I'm happy if someone says there's an OOTB way to do this).</p> <p>wrap <code>UserProfile</code> (the .net Entity from <code>SimpleMembership</code>) in a session class.</p> <pre><code>public static class sessionHelpers { public static UserProfile userProfile { get { if (HttpContext.Current.Session["userProfile"] != null) { return HttpContext.Current.Session["userProfile"] as UserProfile; } else { using (UsersContext db = new UsersContext()) { HttpContext.Current.Session["userInfo"] = db.UserProfiles.Where(x =&gt; x.UserName == HttpContext.Current.User.Identity.Name).FirstOrDefault(); return db.UserProfiles.Where(x =&gt; x.UserName == HttpContext.Current.User.Identity.Name).FirstOrDefault(); } } } set { HttpContext.Current.Session["userProfile"] = value; } } } </code></pre> <p>From this you can access the profile table by doing</p> <pre><code>string foo = sessionHelpers.userProfile.FIELDNAME; </code></pre> <p>where <code>sessionHelpers</code> is my wrapper class. The if block just ensures that if it hasn't been set in the current session that accessing it will attempt to get it.</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