What you need is to turn on cascading. I think you're doing something like this:
Nota.ItemsNotas.Clear();
Context.Entry(Nota).State = EntityState.Deleted;
Context.SaveChanges();
The Entity Framework (6) automatically uses some conventions for cascading deletion. Usually these conventions are taken away for the programmer to add where he wants it to occur:
//Não vai permitir que campos REQUIRED sofra Cascade Delete.
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
Removing these conventions is interesting because it is not always that you want Cascade DELETE to occur.
To activate it in just one relationship (in your case Note and ItemNote) you need to set up Notes for:
HasMany(e => e.ItemNotas)
.WithRequired(e => e.Nota)
.HasForeignKey(e => e.NotaId)
.WillCascadeOnDelete(true);
03.10.2017 / 15:55