I posted this issue on [the lightswitch forum](http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/699bd660-9b8f-4627-89d1-9dfa23bf2d6d) and got nothing. I thought I'd try one more time before giving up on Lightswitch.

I'm implementing deletes against a Sql Server database with well defined relational constraints. For various reasons, I can't specify cascade delete on those relationships.

My approach seems correct because I am successfully deleting one entity type. In the entity's Deleting event, I'm deleting all related children like this:

```
entity.simpleChild.Delete();

foreach (var child in entity.complexChild)
{
    ((IEntityObject)child).Delete();
}

foreach (var child in entity.ChildWithGrandChildren)
{
    foreach (var grandChild in child.Children)
    {
        ((IEntityObject)grandChild).Delete();
    }
    child.Delete();
}

```

One of my entity types is failing, however. This entity has grandchildren, but I'm deleting those as well. Not only that, but when I comment out the deletion of grandchildren and attempt to delete an entity that has no related grandchildren, I get the same error. I'm deleting everything in the same order as a TSQL script that works. At run time, however, I get this error:

*The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted.*

When I profile the database, I can see lots of selects, but no attempts at deletion, so Lightswitch just *thinks* there will be a problem. What can I do to try to figure out where the problem is? Removing various related entities from the model never produces any different message.