title: SqlException: Invalid object name 'dbo.ApplicationUsers'
body: <p>When displaying the <code>AspNetUser.Email</code> from my <code>Customer</code> view I get this error.  I am doing a <code>.Include(AspNetUser)</code> on the <code>CustomerController</code> and referencing the database table name <code>AspNetUser</code> where <code>Email</code> is coming from.  Not sure what I'm missing here but I need to be able to call <code>AspNetUser.Email</code> from the <code>Customer</code> view.  </p>
  
  <p>My<code>ApplicationUser</code> comes from my <code>IdentityModel</code> which I have included below.</p>
  
  <p>In my <code>Customer</code> table I have a <code>Customer.UserId</code> column which is a foreign key to the <code>AspNetUser.Id</code> column.  </p>
  
  <p><strong>Customer Model</strong></p>
  
  <pre><code>namespace DemoPool.Models
  {
      using System;
      using System.Collections.Generic;
      using System.ComponentModel.DataAnnotations;
      using System.ComponentModel.DataAnnotations.Schema;
      using System.Data.Entity.Spatial;
  
      [Table("Customer")]
      public partial class Customer
      {
          [StringLength(128)]
          public string UserId { get; set; }
  
          [ForeignKey("UserId")]
          public virtual ApplicationUser AspNetUser { get; set; }
      }
  }
  </code></pre>
  
  <p><strong>Customer Controller</strong></p>
  
  <pre><code>// GET: Customers
          [Authorize(Roles = "Admin, User")]
          public ActionResult Index()
          {
              var customers = db.Customers.Include(c =&gt; c.AspNetUser);
              return View(customers.ToList());
  
          }
  </code></pre>
  
  <p><strong>Customer View</strong></p>
  
  <pre><code>@model IEnumerable&lt;DemoPool.Models.Customer&gt;
  &lt;table class="table"&gt;
    &lt;tr&gt;
      &lt;td&gt;               
        @Html.DisplayFor(modelItem =&gt; item.AspNetUser.Email)
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>IdentityModel</strong></p>
  
  <pre><code>using System.Data.Entity;
  using System.Security.Claims;
  using System.Threading.Tasks;
  using Microsoft.AspNet.Identity;
  using Microsoft.AspNet.Identity.EntityFramework;
  
  namespace DemoPool.Models
  {
      // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit https://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
      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 class ApplicationDbContext : IdentityDbContext&lt;ApplicationUser&gt;
      {
          public ApplicationDbContext()
              : base("DemoPoolEntities", throwIfV1Schema: false)
          {
          }
  
          public static ApplicationDbContext Create()
          {
              return new ApplicationDbContext();
          }
      }
  }
  </code></pre>