Foreign keys

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
[758 byte] By [overthetop] at [2008-2-28]
# 1

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

ColinMeek at 2007-10-7 > top of Msdn Tech,Visual Studio Orcas,ADO.NET Orcas...

Visual Studio Orcas

Site Classified