mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	- 修复 聚合根仓储 InsertOrUpdate 非自增无法插入的 bug;
This commit is contained in:
		@@ -168,12 +168,9 @@ namespace FreeSql
 | 
				
			|||||||
                return entity;
 | 
					                return entity;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
 | 
					            if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
 | 
					                Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
 | 
				
			||||||
            return await InsertAsync(entity, cancellationToken);
 | 
					            return await InsertAsync(entity, cancellationToken);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            throw new Exception(DbContextStrings.CannotAdd_PrimaryKey_NotSet(Orm.GetEntityString(EntityType, entity)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public virtual Task<int> UpdateAsync(TEntity entity, CancellationToken cancellationToken = default) => UpdateAsync(new[] { entity }, cancellationToken);
 | 
					        public virtual Task<int> UpdateAsync(TEntity entity, CancellationToken cancellationToken = default) => UpdateAsync(new[] { entity }, cancellationToken);
 | 
				
			||||||
        async public virtual Task<int> UpdateAsync(IEnumerable<TEntity> entitys, CancellationToken cancellationToken = default)
 | 
					        async public virtual Task<int> UpdateAsync(IEnumerable<TEntity> entitys, CancellationToken cancellationToken = default)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -221,12 +221,9 @@ namespace FreeSql
 | 
				
			|||||||
                return entity;
 | 
					                return entity;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
 | 
					            if (table.Primarys.Where(a => a.Attribute.IsIdentity).Count() == table.Primarys.Length)
 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
 | 
					                Orm.ClearEntityPrimaryValueWithIdentity(EntityType, entity);
 | 
				
			||||||
            return Insert(entity);
 | 
					            return Insert(entity);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
            throw new Exception(DbContextStrings.CannotAdd_PrimaryKey_NotSet(Orm.GetEntityString(EntityType, entity)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public virtual int Update(TEntity entity) => Update(new[] { entity });
 | 
					        public virtual int Update(TEntity entity) => Update(new[] { entity });
 | 
				
			||||||
        public virtual int Update(IEnumerable<TEntity> entitys)
 | 
					        public virtual int Update(IEnumerable<TEntity> entitys)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,7 @@
 | 
				
			|||||||
		<SignAssembly>true</SignAssembly>
 | 
							<SignAssembly>true</SignAssembly>
 | 
				
			||||||
		<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
 | 
							<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
 | 
				
			||||||
		<DelaySign>false</DelaySign>
 | 
							<DelaySign>false</DelaySign>
 | 
				
			||||||
		<Version>1.0.3</Version>
 | 
							<Version>1.0.5</Version>
 | 
				
			||||||
	</PropertyGroup>
 | 
						</PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	<ItemGroup>
 | 
						<ItemGroup>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user