dzconception

dzconception

  • NA
  • 56
  • 9.7k

EF Master Detail error msg

May 4 2018 3:13 PM
hi .. i have master/dtail relation ith EF
 my code :
  1. EngagDBEntities db;  
  2.   
  3.   
  4.     public EDITENGFrm(object obj)  
  5.     {  
  6.         InitializeComponent();  
  7.         db = new EngagDBEntities();  
  8.         if (obj == null)  
  9.         {  
  10.             engagementBindingSource.DataSource = new Engagement();  
  11.             db.Engagements.Add(engagementBindingSource.Current as Engagement);  
  12.   
  13.   
  14.   
  15.         }  
  16.         else  
  17.         {  
  18.            engagementBindingSource.DataSource = obj;  
  19.            db.Engagements.Attach(engagementBindingSource.Current as Engagement);  
  20.   
  21.   
  22.         }  
  23.   
  24.     }  
 why i have this error when updatig master table :
An entity object cannot be referenced by multiple instances of IEntityChangeTracker 

Answers (1)