I have an EF model (and corresponding MSSQL table) "HCF".
I have another EF model (and MSSQL table), "HCFNotes". There's no foreign key constraint or ManyToOne: they're just two separate tables.
I have an ASP.Net Core Razor page that deletes the HCF record like this:
var HCF = await _context.HCF.FindAsync(id);
_context.HCF.Remove(HCF);
await _context.SaveChangesAsync();
I can get a list of the "associated notes" with this LINQ:
IQueryable<HCReportingNote> notesQuery =
from n in _context.HCReportingNotes
where n.HCFId == HCF.ID
select n;
I can delete all the associated notes in raw SQL like this:
delete from HCReportingNotes where ID = HCFId
But I'd prefer to use LINQ.
Q: What's the "correct" syntax to .Select() the list and .Remove() or .Clear() the associated notes?