title: What is the best way to map a one to many relationship between `ApplicationUser` and its data in ASP.NET?
body: <p>To define a one to many relationship between for example, an <strong>artist</strong> and an <strong>album</strong>, I would create two scaffolded items from the two models/classes below: </p>
  
  <pre><code>public class Album
  {
       public int AlbumID { get; set; }
       [Display(Name="Album Title")]
       public string AlbumTitle { get; set; }
       [Display(Name = "Artist")]
       public int ArtistID { get; set; }
       public virtual Artist Artist { get; set; }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Artist
  {
      public int ArtistID { get; set; }
      [Display(Name="Artist")]
      public string ArtistName { get; set; }
      public virtual ICollection&lt;Album&gt;  Album { get; set; }
  }
  </code></pre>
  
  <p>That would generate a <code>Create.cshtml</code> view (among others) for <code>Album</code>, with a drop-down list of <strong>artists</strong>.<br /><br /><hr>Now I have an application with an <code>Image</code> model and an <code>ApplicationUser</code> model defining a relationship where each <strong>application user</strong> can upload many <strong>images</strong>.</p>
  
  <pre><code>public class ApplicationUser : IdentityUser
      {
          public async Task&lt;ClaimsIdentity&gt; GenerateUserIdentityAsync(UserManager&lt;ApplicationUser&gt; manager)
          {
              // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
              var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
              // Add custom user claims here
              return userIdentity;
          }
          public string UserFirstName { get; set; }
          public string UserSurname { get; set; }
          public virtual ICollection&lt;Image&gt;  Image { get; set; }
      }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Image
  {
       public int ImageID { get; set; }
       [Display(Name="Caption")]
       public string ImageCaption { get; set; }
       public int NumOfLikes { get; set; }
       [Display(Name = "Image")]
       public byte ImageFile { get; set; }
       // WHERE THE ApplicationUser FOREIGN KEY SHOULD BE
       public virtual ApplicationUser ApplicationUser { get; set; }
   }
  </code></pre>
  
  <p><hr />
  Now my problem is that I don't know how to use <code>ApplicationUser</code>'s key as a foreign key in the <code>Image</code> model as I did in the <code>Album</code> model for <code>Artist</code>. A user should be able to upload an image without having to select his or her name from a drop-down list of users. That is, every <strong>image</strong> that a user uploads can only belong to that current <strong>Identity User</strong>.<br /><br /><h1>Questions</h1></p>
  
  <ol>
  <li>What is the best way to map a relationship between <code>ApplicationUser</code>
  and <code>Image</code> where every image uploaded by a user can only belong to
  that user (therefore no drop-down list)?</li>
  <li>How would I return <code>ApplicationsUser</code>'s <code>UserFirstName</code> and <code>UserSurname</code> in <code>Image</code>'s <strong>index</strong> view (displaying the name and surname instead of the username associated with each image displayed)?  </li>
  </ol>