bulk insert and update Dapper Plus Manager with postgresql using .net core error syntax error at or near "ORDER"

-1

I using dapper plus manager to bulk insert/update but I installed the latest version dapper plus and my code not working now.

My error and code

RE Question: I want to bulk insert / update but i see many error , {Npgsql.PostgresException (0x80004005): 42601: syntax error at or near "ORDER" at Npgsql.NpgsqlConnector.<>c__DisplayClass169_0.<g__ReadMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlConnector.<>c__DisplayClass169_0.<g__ReadMessageLong|0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming) at Npgsql.NpgsqlDataReader.NextResult() at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at .(DbCommand , BulkOperation , Int32 ) at .( , DbCommand ) at .Execute(List1 actions) at Z.BulkOperations.BulkOperation.Execute() at Z.Dapper.Plus.DapperPlusAction.Execute() at Z.Dapper.Plus.DapperPlusActionSet1.DapperPlusActionSetBuilder(DapperPlusContext context, IDbConnection connection, IDbTransaction transaction, String mapperKey, DapperPlusActionKind actionKind, IEnumerable1 items, Func2[] selectors) at Z.Dapper.Plus.DapperPlusExtensions.BulkInsert[T](IDbConnection connection, String mapperKey, IEnumerable1 items, Func2[] selectors) at Z.Dapper.Plus.DapperPlusExtensions.BulkInsert[T](IDbConnection connection, IEnumerable1 items, Func2[] selectors) at Persistance_Layer.Dapper.DapperBulkWriteRepository1.BulkInsert(IEnumerable1 entityList) in F:\Bitbucket_Repos\UcuzaMarket\Persistance_Layer\Dapper\DapperBulkWriteRepository.cs:line 21 at Infrastructure_Layer.HangfireService.HangfireService.AddA101ProductProgress() in F:\Bitbucket_Repos\UcuzaMarket\Infrastructure_Layer\HangfireService\HangfireService.cs:line 362 Exception data: Severity: ERROR SqlState: 42601 MessageText: syntax error at or near "ORDER" Position: 510 File: scan.lsd Line: 1150 Routine: scanner_yyerror}

i did update dapper plus manager and this code not working now

DapperPlusManager.Entity<TEntity>().Table(typeof(TEntity).Name).Identity("Id").BatchTimeout(12000).BatchSize(50000);
        using (var connection = new NpgsqlConnection(_connectionString))
        { 
            connection.BulkInsert(entityList);
        }
.net
postgresql
bulkinsert
asked on Stack Overflow Aug 2, 2020 by childofthealgorithm • edited Aug 2, 2020 by childofthealgorithm

1 Answer

0

I used another project, link: https://bulk-operations.net/

INSERT:

using (var bulk = new BulkOperation(connection))
        {
            // easy to use
            bulk.DestinationTableName = "Customers";

            bulk.BulkInsert(dtCustomers);
        }

UPDATE:

using (var bulk = new BulkOperation(connection))
        {
            // easy to use
            bulk.DestinationTableName = "Customers";

            bulk.BulkUpdate(dtCustomers);
        }

User contributions licensed under CC BY-SA 3.0