title: Error when referencing entities from ASP.Net MVC project in Azure Function project
body: <p>I have a ASP.Net MVC project that contains my db entities and my context uses IdentityDbContext applicationuser</p>
  
  <pre><code>public class MyprojectContext : IdentityDbContext&lt;ApplicationUser&gt;
  </code></pre>
  
  <p>everything works fine connecting and fetching database data!</p>
  
  <p>I also have a azure functions project to perform work and I need to access the db (using entity framework) and fetch different entity data. So I referenced the MVC app in the Azure Function app so I could have all the entities/classes.</p>
  
  <p>But when I try and fetch data into one of the entities 'YogaSpaceEvent' I get the error below, if I create my own entity in the Azure Function code (see code below) it works fine and fetches the data. </p>
  
  <p>I'm guessing it might have something to do with each member fetching data in the MVC app using </p>
  
  <pre><code>IdentityDbContext&lt;ApplicationUser&gt;
  </code></pre>
  
  <p>and in the Azure Function app I'm only using DbContext????</p>
  
  <blockquote>
    <p>System.Data.Entity.ModelConfiguration.ModelValidationException: 'One or more validation errors were detected during model generation:
    PostEventEmail.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType.</p>
  </blockquote>
  
  <pre><code>namespace PostEventEmail
  {
  public static class PostEventEmail
  {
      [FunctionName("PostEventEmail")]
      public static void Run([TimerTrigger("0 */1 * * * *")]TimerInfo myTimer, TraceWriter log)
      {
          log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
  
          YogaSpaceEvent newEvent = new YogaSpaceEvent(); // references the Asp.Net MVC app entity
  
          using (var dbContext = new YogabandyContext())
          {
              var ybEvents = dbContext.YogaSpaceEvent.FirstOrDefault();
              log.Info("event id = " + ybEvents.YogaSpaceEventId);
          }          
      }
  
      // if I uncomment this and use it, it works fine and fetches data
      //public class YogaSpaceEvent
      //{
      //    public int YogaSpaceEventId { get; set; }
      //}
  
      public partial class YogabandyContext : DbContext
      {
          public YogabandyContext()
              : base("Server=tcp:yoga2017.database.windows.net,1433;Initial Catalog=Yoga2017;Persist Security Info=False;User ID=chuckd;Password=**********!;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;")
          {
          }
  
          public DbSet&lt;YogaSpaceEvent&gt; YogaSpaceEvent { get; set; }
  
          protected override void OnModelCreating(DbModelBuilder modelBuilder)
          {
              //base.OnModelCreating(modelBuilder);
          }
      }
  
  }
  </code></pre>
  
  <p>}</p>