C# Unable to determine the principal end of the relationship

后端 未结 2 1805
逝去的感伤
逝去的感伤 2021-02-05 01:20
foreach (var item in order.MyFiles)
{
   var newFile = adapter.db.File.CreateObject();

   newFile.Name = item.FileName;

   adapter.db.File.AddObject(newFile);

   adap         


        
2条回答
  •  失恋的感觉
    2021-02-05 02:05

    This could be because of a cyclic reference in you EDMX back to the same table.

    Means for example if EmployeeDepartment is the table that you are going to update and the Primary key is EmployeeDepartmentID and if it is identity column and auto-generated, Check in the EDMX whether the EmployeeDepartmentID is referenced back to itself. If so, right click on that foreigh key reference and click delete.

    This worked for me and I hope this works for you as well.

    Thanks,

    Bibin.

提交回复
热议问题