locked
Foreign keys RRS feed

  • Question

  • Hi

    I've got this exception when I tried to delete an Employee from Northwind table.

    Unable to determine an order of operations that does not violate a foreign key constraint amongst the following tables: Employees

    is this mean that I have to manually write the Association in the .csdl file (for all table related with Employees), then before call db.DelelteObject(employee) call DelelteObject for all related objects like orders, order_details and etc.? What is the right way delete an Employee? And another question: why the Association between Orders and Order_Details, Employees and EmployeeTerritories are not generated, but for Employees and Orders there is one? Or the error means something else :)

    10x
    Tuesday, September 5, 2006 1:42 PM

Answers

  • Hi,

    In the current CTP, we do not support tables with self-references. We will support these scenarios in the final release.

    For now, you can work around the limitation by removing the foreign key declaration from the SSDL file and adding employees one at a time through the object context. Note that you can maintain the self-association in the model (the CSDL does not need to be changed).

    -Colin

    Monday, September 11, 2006 10:21 PM