Code: Select all
public class Blog
{
public int BlogId { get; set; }
public string Url { get; set; }
public List<Post> Posts { get; set; }
}
public class Post
{
public int PostId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public Blog Blog { get; set; }
}
If you mark the entity object Blog and Posts as deleted and hit save, is the framework smart enough to know you need to delete the Posts first before it deletes the Blog?
Conversely, if you Add a Blog and Post to a DBCONTEXT, does it know that it needs to create the Blog first before it creates the Posts?