title: Conflicting changes with code first foreign key in Entity Framework
body: <p>im using an adapter to be able to plug interfaces rather than concrete types into dbcontext. the adapter works on its own, but im having trouble with getting the any one-to-one (parent child) relationships to be saved into the database:</p>
  <h3>Exception Source</h3>
  <pre><code>public void SaveDomain(IDomain domain){
      _entityRepositor = new Donors();
      _entityRepositor.DomainReps.Add(new DomainRep(domain));                
  }
  </code></pre>
  <h3>InvalidOperationException</h3>
  <p><code>Conflicting changes to the role 'DomainRep_TopLevelDomainRep_Target' of the relationship 'Edonics.Repositor.DomainRep_TopLevelDomainRep' have been detected.</code></p>
  <h3>The Foreign Key Properties and the Navigation Properties Should Be in Sync?</h3>
  <pre><code>public class DomainRep: IDomain
  {
      private readonly IDomain _adaptee;        
  
  
      public DomainRep(IDomain adaptee)
      {
          _adaptee = adaptee;
      }
  
      [NotMapped]
      public IDomain Adaptee
      {
          get { return _adaptee; }
      }
  
      public string Id
      {
          get { return _adaptee.Id; }
          set { _adaptee.Id = value; }
      }
  
      public string TopLevelDomainRepId
      {
          get { return _adaptee.Tld.Id; }
  
          set { }
      }
  
      [ForeignKey(&quot;TopLevelDomainRepId&quot;)]
      public TopLevelDomainRep TopLevelDomainRep
      {
          get { return new TopLevelDomainRep(Tld); }
          set { Tld = value.Adaptee; }
      }
  
      public ITopLevelDomain Tld
      {
          get { return _adaptee.Tld; }
          set { _adaptee.Tld = value; }
      }
  
      public string SecondLevelDomainRepId
      {
          get { return _adaptee.Sld.Id; }  
          
          set { } 
      }
  
      [ForeignKey(&quot;SecondLevelDomainRepId&quot;)]
      public SecondLevelDomainRep SecondLevelDomainRep
      {
          get { return new SecondLevelDomainRep(Sld); }
          set { Sld = value.Adaptee; }
      }
  
      public ISecondLevelDomain Sld
      {
          get { return _adaptee.Sld; }
          set { _adaptee.Sld = value; }
      }
      
  }
  </code></pre>
  <p><em>Any ideas?</em></p>