儲存資料Saving Data

每個內容執行個體的 ChangeTracker 都負責追蹤寫入至資料庫所需的變更。Each context instance has a ChangeTracker that is responsible for keeping track of changes that need to be written to the database. 當您變更實體類別的執行個體時,這些變更會記錄在 ChangeTracker 中,然後在您呼叫 SaveChanges 時寫入至資料庫。As you make changes to instances of your entity classes, these changes are recorded in the ChangeTracker and then written to the database when you call SaveChanges. 資料庫提供者負責將變更轉譯成資料庫特定作業 (例如關聯式資料庫的 INSERTUPDATEDELETE 命令)。The database provider is responsible for translating the changes into database-specific operations (for example, INSERT, UPDATE, and DELETE commands for a relational database).