Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Getting the Id is pretty straight forward and you've solved that.</p> <p>Your second question though is a little more involved.</p> <p>So, this is all prerelease stuff right now, but the common problem you're facing is where you're extending the user with new properties ( or an Items collection in you're question).</p> <p>Out of the box you'll get a file called <code>IdentityModel</code> under the Models folder (at the time of writing). In there you have a couple of classes; <code>ApplicationUser</code> and <code>ApplicationDbContext</code>. To add your collection of <code>Items</code> you'll want to modify the <code>ApplicationUser</code> class, just like you would if this were a normal class you were using with Entity Framework. In fact, if you take a quick look under the hood you'll find that all the identity related classes (User, Role etc...) are just POCOs now with the appropriate data annotations so they play nice with EF6.</p> <p>Next, you'll need to make some changes to the <code>AccountController</code> constructor so that it knows to use your DbContext.</p> <pre><code>public AccountController() { IdentityManager = new AuthenticationIdentityManager( new IdentityStore(new ApplicationDbContext())); } </code></pre> <p>Now getting the whole user object for your logged in user is a little esoteric to be honest. </p> <pre><code> var userWithItems = (ApplicationUser)await IdentityManager.Store.Users .FindAsync(User.Identity.GetUserId(), CancellationToken.None); </code></pre> <p>That line will get the job done and you'll be able to access <code>userWithItems.Items</code> like you want.</p> <p>HTH</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