/// <summary> /// Configure the receiver with a given settings dictionary. /// </summary> /// <param name="settings"></param> void IReceiver.Configure(IEnumerable <Setting> settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } var properties = settings.ToDictionary(s => s.Key, s => s); Setting configuredTakeRecords = properties.ReadOptionalProperty(SettingKeys.TakeRows, null); if (configuredTakeRecords == null || Int32.TryParse(configuredTakeRecords.Value, out int takeRecords) == false) { takeRecords = DatastoreReceiverSettings.DefaultTakeRows; } TimeSpan pollingInterval = GetPollingIntervalFromProperties(properties); Setting updateSetting = properties.ReadMandatoryProperty(SettingKeys.Update); if (updateSetting["field"] == null) { throw new ConfigurationErrorsException( "The Update setting does not contain a field attribute that indicates the field that must be updated"); } _settings = new DatastoreReceiverSettings( tableName: properties.ReadMandatoryProperty(SettingKeys.Table).Value, filter: properties.ReadMandatoryProperty(SettingKeys.Filter).Value, updateField: updateSetting["field"].Value, updateValue: updateSetting.Value, pollingInterval: pollingInterval, takeRows: takeRecords); }
/// <summary> /// Configure the receiver with typed settings. /// </summary> /// <param name="settings"></param> public void Configure(DatastoreReceiverSettings settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } _settings = settings; }