title: Using Fluent API instead of InverseProperty and navigational properties
body: <p>I have a database model where there is a relationship between models which gives Code First some issues. Below is an constructed example.</p>
  
  <p>One reader can have read several books, and one book can have been read by several readers.
  Also, each reader might have a favorite book.</p>
  
  <pre><code>//not-working model
  public class BookReader
  {
      public virtual List&lt;Book&gt; ReadBooks { get; set; }
      public virtual Book FavoriteBook { get; set; }
      public int ID { get; set; }
  }
  
  public class Book
  {
      public string BookName { get; set; }
      public int ID { get; set; }
  }
  </code></pre>
  
  <p>This does not work very well. If, in the code, multiple readers are set to have read the same book only one of the readers will get it saved to the db (presumably the last set).
  <br/><br>Also, if BookReader.FavoriteBook and BookReader.ReadBooks contain the same book and db.SaveChanges() creates this new book (not an existing db entity) it will result in this error:
  <br/><em>An error occurred while saving entities that do not expose foreign key properties for their relationships.</em></p>
  
  <p>Here is my fix with InverseProperty and navigational properties.</p>
  
  <pre><code>//working model
  public class BookReader
  {
      [InverseProperty("CurrentReaders")]
      public virtual List&lt;Book&gt; ReadBooks { get; set; }
      public virtual Book FavoriteBook { get; set; }
  
      public int ID { get; set; }
  }
  
  public class Book
  {
      public string BookName { get; set; }
      public int ID { get; set; }
      //new, unwanted, property
      public virtual List&lt;BookReader&gt; CurrentReaders { get; set; }
  }
  </code></pre>
  
  <p><br/>
  I do not wish to change the model like this. Is there a way this can be done with Fluent API without changing the model?
  <br/><br/><em>I've posted a similar question earlier, but deleted it because the question turned out irrelevant to the problem</em></p>