Example #1
0
        /// <summary>
        /// 计算要插入、更新或删除的已修改对象的集,并执行相应命令以实现对数据库的更改
        /// </summary>
        /// <returns></returns>
        public virtual int SubmitChanges()
        {
            int rowCount = _dbQueryables.Count;

            if (rowCount == 0)
            {
                return(0);
            }

            List <DbCommandDefinition> sqlList = _provider.Resolve(_dbQueryables);
            List <int> identitys = _database.Submit(sqlList);

            SetAutoIncrementValue(_dbQueryables, identitys);
            this.InternalDispose();

            return(rowCount);
        }