@ -58,7 +58,17 @@ namespace SqlSugar
{
foreach ( var item in datas )
{
this . _ Context . Insertable ( item ) . ExecuteCommandIdentityIntoEntity ( ) ;
if ( IsFirst & & _ RootOptions ! = null )
{
this . _ Context . Insertable ( item )
. IgnoreColumns ( _ RootOptions . IgnoreColumns )
. InsertColumns ( _ RootOptions . InsertColumns )
. ExecuteCommandIdentityIntoEntity ( ) ;
}
else
{
this . _ Context . Insertable ( item ) . ExecuteCommandIdentityIntoEntity ( ) ;
}
}
}
@ -142,7 +152,17 @@ namespace SqlSugar
pkColumn . PropertyInfo . SetValue ( child , value ( ) ) ;
}
}
this . _ Context . Insertable ( insertData ) . ExecuteCommand ( ) ;
if ( IsFirst & & _ RootOptions ! = null )
{
this . _ Context . Insertable ( insertData )
. IgnoreColumns ( _ RootOptions . IgnoreColumns )
. InsertColumns ( _ RootOptions . InsertColumns )
. ExecuteCommand ( ) ;
}
else
{
this . _ Context . Insertable ( insertData ) . ExecuteCommand ( ) ;
}
}
private void SetError < TChild > ( EntityColumnInfo pkColumn , List < TChild > insertData ) where TChild : class , new ( )
{
@ -154,7 +174,17 @@ namespace SqlSugar
Check . ExceptionEasy ( $"The field {name} is not an autoassignment type and requires an assignment" , $"字段{name}不是可自动赋值类型需要赋值(并且不能是已存在值) , 可赋值类型有 自增、long、Guid、string" ) ;
}
}
this . _ Context . Insertable ( insertData ) . ExecuteCommand ( ) ;
if ( IsFirst & & _ RootOptions ! = null )
{
this . _ Context . Insertable ( insertData )
. IgnoreColumns ( _ RootOptions . IgnoreColumns )
. InsertColumns ( _ RootOptions . InsertColumns )
. ExecuteCommand ( ) ;
}
else
{
this . _ Context . Insertable ( insertData ) . ExecuteCommand ( ) ;
}
}
}
}