Database Reference
In-Depth Information
Figure 12-8. A model with ingredients and steps for each recipe
Listing 12-6. Demonstrating the DeleteRelatedEntities<>() Method
class Program
{
static void Main(string[] args)
{
RunExample();
}
static void DeleteRelatedEntities<T>(T entity, EFRecipesEntities context)
where T : EntityObject
{
var entities = ((IEntityWithRelationships)entity)
.RelationshipManager.GetAllRelatedEnds()
.SelectMany(e =>
e.CreateSourceQuery().OfType<EntityObject>()).ToList();
foreach (var child in entities)
 
Search WWH ::




Custom Search