public void RegisterAdd(IAggregateRoot entity,IUnitOfWorkRepository unitOfWorkRepo) { if(!addedEntities.ContainsKey(entity)) { addedEntities.Add(entity,unitOfWorkRepo); } } public void RegisterRemoved(IAggregateRoot entity,IUnitOfWorkRepository unitOfWorkRepo) { if(!deletedEntities.ContainsKey(entity)) { deletedEntities.Add(entity,unitOfWorkRepo); } } public void Commit() { using (TransactionScope scope =new TransactionScope()) { this.addedEntities.Keys.ToList().ForEach(q=> { this.addedEntities[q].PersistCreationOf(q); //疑问1:假如这边PersistCreationOf用的 ado.net执行完了 创建,这边非sql级别的 事物还可以回滚吗? }); this.changedEntities.Keys.ToList().ForEach(q => { this.changedEntities[q].PersistUpdateOf(q); }); this.deletedEntities.Keys.ToList().ForEach(q => { this.deletedEntities[q].PersistDeletionOf(q); }); } } }
//疑问1:假如这边PersistCreationOf用的 ado.net执行完了 创建,这边非sql级别的 事物还可以回滚吗?