title: Entity Inserts instead of Update
body: <p>In my web i am retrieving a question object <strong>Including</strong> the subcategories it falls in and the language related data.  It also has the QuestionID that is Primary Key for Question. I place this object in PageSession and modify the properties if user wants to.</p>
  
  <pre><code>using (var bo = new BL.QuestionBO())
  {
      var question = bo.Get(QuestionID);
      PageSession.CurrentQuestion = question;
  }   
  
  public Question Get(long QuestionID)
  {
      return DataSource.Questions
          .Include(q =&gt; q.TransQuestions)
          .Include(q =&gt; q.SubCategories)
          .FirstOrDefault(q =&gt; q.QuestionID == QuestionID);
  }
  </code></pre>
  
  <p>When I add the object back to the DataContext it adds a new object instead of updating the privious one. </p>
  
  <pre><code>DataSource.Questions.Add(QuestionEnt);
  DataSource.SaveChanges();
  </code></pre>
  
  <p>Am i missing something or coding wrongly?</p>
  
  <p>I have below areas in which i may be wrong. </p>
  
  <ol>
  <li>The data context objects are different while retrieving an object.</li>
  <li>I am using Questions.Add()</li>
  <li>The proxy object may be don't care about insert/update.</li>
  </ol>
  
  <p>Below is the class generated by .edmx</p>
  
  <pre><code>    public partial class Question
  {
      public Question()
      {
          this.ChallengeDetails = new HashSet&lt;ChallengeDetail&gt;();
          this.TransQuestions = new HashSet&lt;TransQuestion&gt;();
          this.SubCategories = new HashSet&lt;SubCategory&gt;();
      }
  
      public long QuestionID { get; set; }
      public int QuestionTypeID { get; set; }
      public int Status { get; set; }
      public int InsertedBy { get; set; }
      public Nullable&lt;int&gt; ModifiedBy { get; set; }
  
      public virtual ICollection&lt;ChallengeDetail&gt; ChallengeDetails { get; set; }
      public virtual QuestionType QuestionType { get; set; }
      public virtual ICollection&lt;TransQuestion&gt; TransQuestions { get; set; }
      public virtual ICollection&lt;SubCategory&gt; SubCategories { get; set; }
  }
  </code></pre>