title: How to unit test EF core 3 view with no key in-memory?
body: <p>I'm playing around with EF Core 3 and writing some unit tests and don't seem to be able to setup test data for a view.</p>
  
  <p>When I'm trying to save, I get the error:</p>
  
  <blockquote>
    <p>Unable to track an instance of type because it does not have a primary key. Only entity types with primary keys may be tracked</p>
  </blockquote>
  
  <pre><code>public class EFContext : DbContext
  {
      public DbSet&lt;ViewItem&gt; ViewItems { get; set; }
  
      protected override void OnModelCreating(ModelBuilder modelBuilder)
      {
          modelBuilder.Entity&lt;ViewItem&gt;().HasNoKey().ToView("vTestView");
      }
  }
  
  using (EFContext efContext = new EFContext())
  {
      efContext.ViewItems.Add(new ViewItem
      {
          Name = "This is test item #1"
      });
  
      efContext.SaveChanges();
  }
  </code></pre>