A database context in EF Core tracks the state of each entity it knows about[1]. It can "know" about the entity if
_context.Add(entity)In a call to _context.SaveChanges() (or SaveChangesAsync()) it will call DetectChanges() (unless it's been disabled via config, in which case you have to do it yourself), creating the SQL to INSERT, UPDATE and DELETE as needed.