I would like to know if is there any posibility to catch something like "OnDelete Event" for cascading deletction of each entity. All classes have implemented cascading and it works flawlessly (removing course removes file RECORDS in DB). My struct is like this:
publi class Course
{
...
public virtual ICollection<Lesson> Lessons {get; set;}
public Course()
{
Lessons = new List<Lesson>();
}
}
public class Lesson
{
...
public virtual ICollection<Section> Section {get; set;}
public Lesson()
{
Section = new List<Section>();
}
}
public class Section
{
...
public virtual File File {get; set;}
}
public class File
{
...
public Uri Uri {get; set;}
// I Would like to catch every delete of file to remove it from server.
}
Now when I remove any lesson from my course i want all files (phisical files on server) related to that lesson (related through Section) to be deleted.
Same problem had @derrick in comment of this solution: Model OnDelete event?