Let's say you have the following tables:
Friend
------
Id int not null (primary key)
Name nvarchar(50) not null
Address
-------
Id int not null (primary key)
FriendId int not null (links to Friend.Id)
City nvarchar(50) null
Country nvarchar(50) not null
Using Entity Framework 4, I am issuing an ObjectContext.ExecuteStoreCommand call to delete some friends. However, I get an error that says something like:
*System.Data.SqlClient.SqlException was unhandled Message=The DELETE statement conflicted with the REFERENCE constraint "FK_Address_Friend". The conflict occurred in database "MyFriends", table "dbo.Address", column 'FriendId'. The statement has been terminated.*
How do I ensure that everything Cascade deletes? Is there some property in the database that I have to set?