FreeSql.DbContext 融合 Repository + UnitOfWork

This commit is contained in:
28810
2019-03-30 19:11:17 +08:00
parent 496750da94
commit a7e06843a9
15 changed files with 222 additions and 264 deletions

View File

@ -11,14 +11,17 @@ using System.Threading.Tasks;
namespace FreeSql {
partial class DbContext {
async public Task<long> SaveChangesAsync() {
async public Task<int> SaveChangesAsync() {
await ExecCommandAsync();
_uow.Commit();
return _affrows;
_uow?.Commit();
var ret = _affrows;
_affrows = 0;
return ret;
}
static Dictionary<Type, Dictionary<string, Func<object, object[], Task<int>>>> _dicExecCommandDbContextBetchAsync = new Dictionary<Type, Dictionary<string, Func<object, object[], Task<int>>>>();
async internal Task ExecCommandAsync() {
if (_actions.Any() == false) return;
ExecCommandInfo oldinfo = null;
var states = new List<object>();