From 9eea4150b3e7c17e7614f6a7eef221414a8f916f Mon Sep 17 00:00:00 2001 From: Virtanen Riku Date: Wed, 5 Feb 2025 13:38:57 +0200 Subject: [PATCH] PR review changes --- .../Frends.MicrosoftSQL.BulkInsert/BulkInsert.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Frends.MicrosoftSQL.BulkInsert/Frends.MicrosoftSQL.BulkInsert/BulkInsert.cs b/Frends.MicrosoftSQL.BulkInsert/Frends.MicrosoftSQL.BulkInsert/BulkInsert.cs index e820c93..ef1f6b4 100644 --- a/Frends.MicrosoftSQL.BulkInsert/Frends.MicrosoftSQL.BulkInsert/BulkInsert.cs +++ b/Frends.MicrosoftSQL.BulkInsert/Frends.MicrosoftSQL.BulkInsert/BulkInsert.cs @@ -105,12 +105,9 @@ private static async Task ExecuteHandler(Options options, Input input, Dat { var rowsCopied = 0L; - - if (input.ColumnMapping == ColumnMapping.JsonPropertyOrder) - { - // ColumnMapping.JsonPropertyOrder is default and is already being handled by SqlBulkCopy. - } - else if (input.ColumnMapping == ColumnMapping.JsonPropertyNames) + // JsonPropertyOrder is handled implicitly (default behavior) by not adding any column mappings, + // which means the columns will be mapped based on their order in the input JSON. + if (input.ColumnMapping == ColumnMapping.JsonPropertyNames) { foreach (var column in dataSet.Tables[0].Columns) sqlBulkCopy.ColumnMappings.Add(new SqlBulkCopyColumnMapping(column.ToString(), column.ToString()));