title: Insert record using entity Framework (database first)
body: <p>there are 3 database tables (movies, reviews, users)</p>
  
  <p>the reviews table include ( MemeberID, MovieID, Review Text, Rate, ReviewDate)
  (the MemeberID, and MovieID in the Review are the FK of the members table and the movies table)
  The Movie can have many reviews, and i'm trying to add review to a movie</p>
  
  <p>even I have movie class and the member class,  I have a problem, in order to insert review, i need to reference it to movie and users , link them, and i don't know how to do it</p>
  
  <p><strong>this code make a error:</strong></p>
  
  <pre><code>" The relationship between the two objects cannot be defined because they are attached to different ObjectContext objects. "
  </code></pre>
  
  <p>This is my code...</p>
  
  <pre><code>public bool InsertNewReview(Movie _TheMovie, Member _TheMember, string _Text, byte _Rate, DateTime _ReviewDate)
      {
  
         Review ReviewToInsert = new Review()
              {
                  MovieID = _TheMovie.MovieID,
                  MemberID = _TheMember.MemberID,
                  Movie = _TheMovie,
                  Member =  _TheMember,
                  Rate = _Rate,
                  ReviewDate = _ReviewDate,
                  ReviewText = _Text
              };
  
          videoLib.Reviews.AddObject(ReviewToInsert);
          videoLib.SaveChanges();
  
              return true;
  
      }
  </code></pre>
  
  <p>..</p>
  
  <p><strong>there are more data to insert to the Review class</strong></p>
  
  <p>Images: <a href="http://www.gamesff.com/1.png" rel="nofollow">here</a></p>
  
  <p>..</p>
  
  <p><strong>and the tables:</strong> (the "all columns" isn't a field in database tables)</p>
  
  <p>Images: <a href="http://www.gamesff.com/2.png" rel="nofollow">here</a></p>