public virtual async Task <TAggregateRoot> AddAndReturnAsync(TAggregateRoot aggregateRoot, bool autoExecute = true, CancellationToken cancellationToken = default) { var addedEntity = (await DbContext.AddAsync(POManager.MapToPO(aggregateRoot), cancellationToken)).Entity; if (autoExecute) { await DbContext.SaveChangesAsync(cancellationToken); } return(POManager.MapToDO(addedEntity)); }
public virtual TAggregateRoot AddAndReturn(TAggregateRoot aggregateRoot, bool autoExecute = true) { var addedEntity = DbContext.Add(POManager.MapToPO(aggregateRoot)).Entity; if (autoExecute) { DbContext.SaveChanges(); } return(POManager.MapToDO(addedEntity)); }