title: Using Both ObjectContext and DbContext
body: <p>Scenario: Trying to extract and rearange information from one database to an other.
  DB A has some data I want to get. I want to store it on DB B in a slightly different structure.</p>
  
  <p>DB A I get using an EDMX database generated model so it uses a derivative of ObjectContext. DB B I would like to be Code generated. So I use the code/model first approach by installing EntityFramework 4.1 via Package manager. So DB B uses a DbContext derivative</p>
  
  <p>When I try to store information from DB A to DB B it's says:</p>
  
  <p><strong>Test method RoutIT.Irma.Import.Service.Test.ImportIrma2ProductTests.ImportProducts threw exception:  System.ArgumentException: Could not find the conceptual model type for 'Some entity in DB A's EDMX model'</strong></p>
  
  <p>It actually does it when adding a DB B entity to the DB B's Derived DbContext's DbSet property. So the code is like</p>
  
  <pre><code>using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
  {
              foreach (FirstPVC pvc in pvcs)
              {
                  this._irmaImport.FirstPVCs.Add(pvc); &lt;--
                  this._irmaImport.SaveChanges();
              }
              scope.Complete();
          }
   }
  </code></pre>
  
  <p>It happens at the point in the code marked by the arrow above ("&lt;--")</p>
  
  <p>FirstPVC is a DB B property yet at the point of the arrow it complanes about not having a conceptual model for an entity belonging to DB B's context.</p>
  
  <p>This is strange since I try to store an DB B entity to the DB B context. Why should it care about entity's of DB A.</p>
  
  <p>All contexts are contained in the same project. But DB B's Derived DbContext only has knowledge about it's own DbSet&lt;> properties, suddenly when trying to add something to the DbSet&lt;> property it give me the error in bold above.</p>
  
  <p>Anybody know why this happens? Why should DbContext care about entity's of another context specifically one of a ObjectContext derived class.</p>
  
  <p>Perhapse it's usefull to note the entity it's complaining about looks a bit like this</p>
  
  <pre><code>[EdmEntityTypeAttribute(NamespaceName="Irma2Model", Name="AccessProvider")]
  [Serializable()]
  [DataContractAttribute(IsReference=true)]
  public partial class AccessProvider : EntityObject
  {
      /*****...... ******/
  }
  </code></pre>