Updated Unit of Work (markdown)

AlexLEWIS
2021-09-08 11:10:41 +08:00
parent c5a204702e
commit 0c9e94fa48

@@ -109,14 +109,15 @@ public enum EntityChangeType { Insert, Update, Delete, SqlRaw }
| Delete | The entity object is deleted |
| SqlRaw | SQL statement executed |
SqlRaw 目前有两处地方比较特殊:
- 多对多联级更新导航属性的时候,对中间表的全部删除操作;
- 通用仓储类 BaseRepository 有一个 Delete 方法,参数为表达式,而并非实体;
SqlRaw currently has two special features:
- When the navigation properties are updated in the many-to-many cascade, delete the relevant data in the intermediate table.
- The common repository `BaseRepository` has a Delete method, and the parameter is an expression, not an entity.
```csharp
int Delete(Expression<Func<TEntity, bool>> predicate);
```
DbContext.SaveChanges,或者 Repository 对实体的 Insert/Update/Delete,或者 UnitOfWork.Commit 操作都会最多触发一次该事件。
`DbContext.SaveChanges` or Repository's Insert/Update/Delete method of the entity, or `UnitOfWork.Commit` operation will trigger this event at most once.
## Reference