private void updateSettings(AppSettings settings) { UseMockDataStore = settings.UseMockDataStore ?? UseMockDataStore; if (settings.ColorPalette != null) { if (ColorPalette == null) { ColorPalette = new List <ColorResource>(settings.ColorPalette); } else { ColorPalette = new List <ColorResource>( ColorPalette.Union(settings.ColorPalette)); } } if (!IsInitialized) { AppSecrets = AppSecrets.UpdateSettings(AppSecrets, settings.AppSecrets); ConnectionStringInfo = ConnectionStringInfo.UpdateSettings(ConnectionStringInfo, settings.ConnectionStringInfo); EmailInfo = EmailInfo.UpdateSettings(EmailInfo, settings.EmailInfo); } }
//* Static Methods public static ConnectionStringInfo UpdateSettings(ConnectionStringInfo @this, ConnectionStringInfo other) { if (AppSettings.IsInitialized) { throw new InvalidOperationException( $"{nameof(ConnectionStringInfo)} cannot be modified after initialization!"); } if (@this == null) { @this = new ConnectionStringInfo(); } @this.ConnectionTimeout = other.ConnectionTimeout ?? @this.ConnectionTimeout; @this.Port = other.Port ?? @this.Port; @this.DatabaseName = other.DatabaseName ?? @this.DatabaseName; @this.Password = other.Password ?? @this.Password; @this.ServerHost = other.ServerHost ?? @this.ServerHost; @this.UserName = other.UserName ?? @this.UserName; return(@this); }