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

@ -10,14 +10,17 @@ using System.Linq.Expressions;
namespace FreeSql {
partial class DbContext {
public long SaveChanges() {
public int SaveChanges() {
ExecCommand();
_uow.Commit();
return _affrows;
_uow?.Commit();
var ret = _affrows;
_affrows = 0;
return ret;
}
static Dictionary<Type, Dictionary<string, Func<object, object[], int>>> _dicExecCommandDbContextBetch = new Dictionary<Type, Dictionary<string, Func<object, object[], int>>>();
internal void ExecCommand() {
if (_actions.Any() == false) return;
ExecCommandInfo oldinfo = null;
var states = new List<object>();