title: working with two entity context from two diffrent server at the same time
body: <p>In my project I have two separate server with separate Entity context, at the first I am fetching data from one server and saving it into a list by this code:</p>
  
  <pre><code>BarForooEntities1 bfe = new BarForooEntities1();
  SaleHistory sh = new SaleHistory();
  RadifsSendCenter rs = new RadifsSendCenter();
  BaskoolEntities be = new BaskoolEntities();
  var q = (from d in bfe.RadifsSendCenter
      where d.Daryaft == true
      orderby d.id_rec
      select d).ToList();
  </code></pre>
  
  <p>And then i save that list to another server database by using this code:</p>
  
  <pre><code>foreach (var v in q)
          {
              sh.id_rec = v.id_rec;
              sh.Radifkolsal = v.Radifkolsal;
              sh.Dates = v.Dates;
              sh.DateErsal = v.DateErsal;
              sh.TimeErsal = v.TimeErsal;
              sh.Karkhane = v.Karkhane;
              sh.Namekala = v.Namekala;
              sh.Vazn = v.Vazn;
              sh.Bandal = v.Bandal;
              sh.Dobaskul = v.Dobaskul;
              sh.OldYear = v.OldYear;
              sh.Sal = v.Sal;
              sh.del = v.del;
              sh.edit = v.edit;
              sh.Daryaft = v.Daryaft;
              sh.Shobe = v.Shobe;
              sh.Greid = v.Greid;
              sh.TedadBas = v.TedadBas;
              sh.Rahgiry = v.Rahgiry;
              sh.Tozih = v.Tozih;
              sh.NoeShemsh = v.NoeShemsh;
              sh.Metrazh = v.Metrazh;
              sh.Keyfiat = v.Keyfiat;
              sh.Address = v.Address;
              sh.City = v.City;
              sh.Karbar = v.Karbar;
              sh.CodeKala = v.CodeKala;
              sh.CodeGoruh = v.CodeGoruh;
              sh.CodeKG = v.CodeKG;
              sh.CodeGreid = v.CodeGreid;
              sh.Tel = v.Tel;
              sh.ShenaseMeli = v.ShenaseMeli;
              sh.Sefaresh = v.Sefaresh;
              sh.Tolid = v.Tolid;
              sh.Shenase = v.Shenase;
              var u = (from bu in be.BarbariUsers
                  where bu.UserName == Login.username
                  select bu).FirstOrDefault();
              sh.UserID = u.UserID;
              sh.ReceiveUser = Login.username;
              sh.ReceiveDateTime = DateTime.Now;
              be.SaleHistory.Add(sh);
              rs.Daryaft = false;
          }
  be.SaveChanges();
  bfe.SaveChanges();
  MessageBox.Show("Done!");
  </code></pre>
  
  <p>When I run my project,everything is working, but just one row of list is added to second list and also updating the first database value(rs.Daryaft = false;) doesn't change anything.
  I know that if I move (be.SaveChanges();) and (bfe.SaveChanges();) inside of foreach loop, just the first one work with taking long time and the second one doesn't make anything. Maybe I'm going a wrong way.
  Any suggestion or other solution to solve this problem?</p>