From 3e7153f5477b0322168686238ea6a9e9b1f9f879 Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Fri, 9 Aug 2024 15:17:06 +0200 Subject: [PATCH] VS suggestions --- SyncChanges/Synchronizer.cs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/SyncChanges/Synchronizer.cs b/SyncChanges/Synchronizer.cs index 5b4ff20..da4066c 100644 --- a/SyncChanges/Synchronizer.cs +++ b/SyncChanges/Synchronizer.cs @@ -12,7 +12,12 @@ namespace SyncChanges /// /// Allows replication of database changes from a source database to one or more destination databases. /// - public class Synchronizer + /// + /// Initializes a new instance of the class. + /// + /// The configuration. + /// is null + public class Synchronizer(Config config) { /// /// Gets or sets a value indicating whether destination databases will be modified during a replication run. @@ -44,19 +49,9 @@ public class Synchronizer public event EventHandler Synced; static readonly Logger Log = LogManager.GetCurrentClassLogger(); - Config Config { get; set; } + Config Config { get; set; } = config ?? throw new ArgumentException("config is null", nameof(config)); bool Error { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The configuration. - /// is null - public Synchronizer(Config config) - { - Config = config ?? throw new ArgumentException("config is null", nameof(config)); - } - private IList> Tables { get; } = new List>(); private bool Initialized = false; @@ -471,9 +466,7 @@ from CHANGETABLE (CHANGES {tableName}, @0) c while (reader.Read()) { - - if (nullableMap == null) - nullableMap = reader.GetNullableTypeMap(); + nullableMap ??= reader.GetNullableTypeMap(); var col = 0; var change = new Change { Operation = ((string)reader[col])[0], Table = table };