From d406b8c41e61b50d2b218f0c4e32cc1b8e487d51 Mon Sep 17 00:00:00 2001 From: Matthias Sebastian Sort Date: Wed, 26 Jun 2024 12:17:14 +0200 Subject: [PATCH 1/2] removed local rowsAffected so it now uses the one from BaseSqlWriter and handling of empty values for processInputRow --- ...namicweb.DataIntegration.Providers.UserProvider.csproj | 4 ++-- src/UserDestinationWriter.cs | 8 -------- src/UserProvider.cs | 7 +++++-- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj b/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj index 098c757..5ec8966 100644 --- a/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj +++ b/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj @@ -1,6 +1,6 @@  - 10.5.0 + 10.6.0 1.0.0.0 User Provider User Provider @@ -23,7 +23,7 @@ snupkg - + diff --git a/src/UserDestinationWriter.cs b/src/UserDestinationWriter.cs index d525da3..7930914 100644 --- a/src/UserDestinationWriter.cs +++ b/src/UserDestinationWriter.cs @@ -64,14 +64,6 @@ internal class UserDestinationWriter : BaseSqlWriter private List MappingsWithUpdateUsersByCustomerNumberMode = new List(); private TableCollection _schemaTables = null; - /// - /// Return rows affected - /// - internal int RowsAffected - { - get; private set; - } - public UserDestinationWriter(Job job, SqlConnection connection, bool removeMissingUsers, bool generateUserPasswords, bool encryptUserPasswords, bool removeMissingGroups, bool UseEmailForUsername, string userKeyField, string mailSubject, string senderEmail, string emailTemplate, bool allowEmail, string destinationGroup, bool deleteOnlyFromGroupsThatAreImportedTo, ILogger logger, diff --git a/src/UserProvider.cs b/src/UserProvider.cs index 015c726..d7dbea9 100644 --- a/src/UserProvider.cs +++ b/src/UserProvider.cs @@ -255,6 +255,7 @@ public UserProvider() UserKeyField = "Auto"; DiscardDuplicates = false; } + public override Schema GetOriginalSourceSchema() { List tablestToKeep = new() { "AccessUser", "AccessUserAddress", "AccessUserSecondaryRelation" }; @@ -706,8 +707,10 @@ public override bool RunJob(Job job) while (!reader.IsDone()) { sourceRow = reader.GetNext(); - ProcessInputRow(mapping, sourceRow); - Writer.Write(sourceRow, mapping, discardDuplicates); + if (ProcessInputRow(sourceRow, mapping)) + { + Writer.Write(sourceRow, mapping, discardDuplicates); + } } } } From 30069ce8212b0648a6327874469c2e37d405d344 Mon Sep 17 00:00:00 2001 From: Matthias Sebastian Sort Date: Wed, 3 Jul 2024 08:18:17 +0200 Subject: [PATCH 2/2] updated references to use BaseSqlProvider.TotalRowsAffected --- ...Dynamicweb.DataIntegration.Providers.UserProvider.csproj | 2 +- src/UserProvider.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj b/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj index 5ec8966..78b1365 100644 --- a/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj +++ b/src/Dynamicweb.DataIntegration.Providers.UserProvider.csproj @@ -23,7 +23,7 @@ snupkg - + diff --git a/src/UserProvider.cs b/src/UserProvider.cs index d7dbea9..cb94cf1 100644 --- a/src/UserProvider.cs +++ b/src/UserProvider.cs @@ -5,8 +5,6 @@ using Dynamicweb.Extensibility.AddIns; using Dynamicweb.Extensibility.Editors; using Dynamicweb.Logging; -using Dynamicweb.Security.Permissions; -using Dynamicweb.Security.UserManagement; using Dynamicweb.Security.UserManagement.Common.SystemFields; using Microsoft.CodeAnalysis; using System; @@ -723,6 +721,7 @@ public override bool RunJob(Job job) sqlTransaction.Commit(); Writer.SendUserPasswords(); MoveRepositoriesIndexToJob(job); + TotalRowsAffected += Writer.RowsAffected; } catch (Exception ex) { @@ -751,6 +750,9 @@ public override bool RunJob(Job job) if (sqlTransaction != null) sqlTransaction.Rollback(); + + TotalRowsAffected = 0; + return false; } finally