title: Entity Framework - List of Class having Same class to parent
body: <p>I have a Parent class of Users and it has Followers list like the following.
  The User class has a list of follower class..</p>
  <pre><code>public class User
  { 
      public User()
      { 
          Followers = new HashSet&lt;Follower&gt;(); 
      }
      [Key]
      public int ID { get; set; }
  
      [Required]
      public string username { get; set; }
        
      public virtual ICollection&lt;Follower&gt; Followers { get; set; }
  }
  </code></pre>
  <p>and the Follower class has other user who follows the parent user.
  like this</p>
  <pre><code>public class Follower
  {
      [Key]
      public int ID { get; set; }
  
      [Required]
      public virtual User user { get; set; }
  }
  </code></pre>
  <p>But when i add object to the list inside the User table,</p>
  <pre><code>parentUser.Followers.Add(new Follower { user = childUser});
  //The parentClass is object of User class
  </code></pre>
  <p>everything looks fine but when the compiler goes through the <code>_myDb.SaveChanges();</code> the Follower User is changed to the parent users.</p>
  <p>and I checked database, it has the following value.</p>
  <pre><code>+----+--------+
  | ID | UserID |
  +====+========+
  | 1  | 1      |
  +----+--------+
  </code></pre>