/// <summary> /// 更新 /// </summary> /// <param name="aggregateRoot"></param> /// <returns></returns> public virtual async Task Update(TAggregateRoot aggregateRoot) { var dbData = await GetDbData(aggregateRoot.Id); var(added, updated, removed) = Tracking(dbData, aggregateRoot); added.ForEach(aAdded => { Db.Entry(aAdded).State = EntityState.Added; }); await Db.SaveChangesAsync(); Tracking(aggregateRoot, dbData); }