mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 01:05:27 +08:00 
			
		
		
		
	- 增加 Repository/DbContext SaveMany 方法实现一对多,子数据的完整保存;
- 调整 SaveManyToMany 方法名为 SaveMany;
This commit is contained in:
		@@ -888,12 +888,16 @@ namespace FreeSql.Internal.CommonProvider
 | 
			
		||||
        public IDelete<T1> ToDelete()
 | 
			
		||||
        {
 | 
			
		||||
            if (_tables[0].Table.Primarys.Any() == false) throw new Exception($"ToDelete 功能要求实体类 {_tables[0].Table.CsName} 必须有主键");
 | 
			
		||||
            return _orm.Delete<T1>().Where(GetToDeleteWhere("ftb_del"));
 | 
			
		||||
            var del = _orm.Delete<T1>();
 | 
			
		||||
            if (_tables[0].Table.Type != typeof(T1)) del.AsType(_tables[0].Table.Type);
 | 
			
		||||
            return del.Where(GetToDeleteWhere("ftb_del"));
 | 
			
		||||
        }
 | 
			
		||||
        public IUpdate<T1> ToUpdate()
 | 
			
		||||
        {
 | 
			
		||||
            if (_tables[0].Table.Primarys.Any() == false) throw new Exception($"ToUpdate 功能要求实体类 {_tables[0].Table.CsName} 必须有主键");
 | 
			
		||||
            return _orm.Update<T1>().Where(GetToDeleteWhere("ftb_upd"));
 | 
			
		||||
            var upd = _orm.Update<T1>();
 | 
			
		||||
            if (_tables[0].Table.Type != typeof(T1)) upd.AsType(_tables[0].Table.Type);
 | 
			
		||||
            return upd.Where(GetToDeleteWhere("ftb_upd"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected List<Dictionary<Type, string>> GetTableRuleUnions()
 | 
			
		||||
 
 | 
			
		||||
@@ -319,7 +319,9 @@ namespace FreeSql.Internal.CommonProvider
 | 
			
		||||
            _tables[0].Parameter = exp.Parameters[0];
 | 
			
		||||
            return this.InternalWhere(exp?.Body);
 | 
			
		||||
        }
 | 
			
		||||
        public ISelect<T1> WhereDynamic(object dywhere) => this.Where(_commonUtils.WhereObject(_tables.First().Table, $"{_tables.First().Alias}.", dywhere));
 | 
			
		||||
        public ISelect<T1> WhereDynamic(object dywhere, bool not = false) => not == false ?
 | 
			
		||||
            this.Where(_commonUtils.WhereObject(_tables.First().Table, $"{_tables.First().Alias}.", dywhere)) :
 | 
			
		||||
            this.Where($"not({_commonUtils.WhereObject(_tables.First().Table, $"{_tables.First().Alias}.", dywhere)})");
 | 
			
		||||
 | 
			
		||||
        public ISelect<T1> WhereCascade(Expression<Func<T1, bool>> exp)
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user