views:

531

answers:

1

I'm using EF4 and STE w/ Silverlight.

I'm having trouble deleting child records from my primary entity. For some reason I can remove child entities if their foreign key to my primary entity is part of their Primary Key.

But if it's not, they don't get removed.

I believe these posts explains it: http://mocella.blogspot.com/2010/01/entity-framework-v4-object-graph.html

http://blogs.msdn.com/dsimmons/archive/2010/01/31/deleting-foreign-key-relationships-in-ef4.aspx

My question is how how do I remove a child record who's foreign key is not part of its primary key in Silverlight where I don't have access to a DeleteObject() function?

A: 

This is what I was trying to do:

PrimaryEntity.Children.Remove(itemToDelete);

But what I had to do to make it work was:

itemToDelete.MarkAsDeleted();