I hate these three tables that. Two tables have a many to many relationship and as such it generates a third table.

I’m using Linq-to-SQL and in the .dbml file I’ve dragged all the folder there to the graphic surface.
Here is the method I’m using to delete an Area safely. Remember that documents are associated to an Area, so I can’t just delete it and leave documents hanging.
ScansDataContext db = new ScansDataContext();
/// <summary>
/// Deletes an Area object from the database along with all associations in the database.
/// </summary>
/// <param name="area">Area object to save</param>
public void Delete(Area area)
{
db.DocumentAreaRelations.DeleteAllOnSubmit(area.DocumentAreaRelations);
db.Areas.DeleteOnSubmit(area);
db.SubmitChanges(System.Data.Linq.ConflictMode.FailOnFirstConflict);
}
Assuming that you still have the constraints in the database that enforce the relationships…that looks like you should be good to go to me. If you don’t have the keys set up in the database, you need to add them.
You’re deleting all the relationships first, the actual entity second, and
SubmitCahnges()wraps everything in a local transaction so that it’s a single unit of work.