@ -70,18 +70,17 @@ namespace SqlSugar
RestoreMapping ( ) ;
return new KeyValuePair < string , List < SugarParameter > > ( sql , InsertBuilder . Parameters ) ;
}
public async Task < List < Type > > ExecuteReturnPkListAsync < Type > ( )
{
return await Task . Run ( ( ) = > ExecuteReturnPkList < Type > ( ) ) ;
}
public virtual List < Type > ExecuteReturnPkList < Type > ( )
{
var pkInfo = this . EntityInfo . Columns . FirstOrDefault ( it = > it . IsPrimarykey = = true ) ;
Check . ExceptionEasy ( pkInfo = = null , "ExecuteReturnPkList need primary key" , "ExecuteReturnPkList需要主键" ) ;
Check . ExceptionEasy ( this . EntityInfo . Columns . Count ( it = > it . IsPrimarykey = = true ) > 1 , "ExecuteReturnPkList ,Only support technology single primary key" , "ExecuteReturnPkList只支技单主键" ) ;
var isIdEntity = pkInfo . IsIdentity | | ( pkInfo . OracleSequenceName . HasValue ( ) & & this . Context . CurrentConnectionConfig . DbType = = DbType . Oracle ) ;
if ( pkInfo . UnderType = = UtilConstants . LongType )
{
return InsertPkListLong < Type > ( ) ;
}
else if ( isIdEntity & & this . InsertObjs . Length = = 1 )
if ( isIdEntity & & this . InsertObjs . Length = = 1 )
{
return InsertPkListIdentityCount1 < Type > ( pkInfo ) ;
}
@ -93,6 +92,10 @@ namespace SqlSugar
{
return InsertPkListWithFunc < Type > ( pkInfo ) ;
}
else if ( pkInfo . UnderType = = UtilConstants . LongType )
{
return InsertPkListLong < Type > ( ) ;
}
else
{
return InsertPkListGuid < Type > ( pkInfo ) ;