/// <summary> /// Создает параметры из объекта Селекция и сохраненных данных /// </summary> /// <param name="setting"></param> /// <returns></returns> public IEnumerable<ParamEntity> GetSettingParams(DataProvider setting) { if (setting.ConnectorInfo == null) throw new CustomException($"settingId={setting.Id}. EntityInfo is null!"); IEnumerable<ParamEntity> savedParams = GetSavedStrategyParams(setting); List<ParamEntity> res = StrategyHelper.GetEntityParams<ParamEntity>(setting.ConnectorInfo, savedParams).ToList(); return res; }
private static IEnumerable<ParamEntity> GetEntityParamsVaried(DataProvider setting) { IEnumerable<ParamEntity> res = null; if(setting.ConnectorInfo != null) res = new SettingHelper().GetSettingParams(setting); else res = new List<ParamEntity>(); return res; }
//////////////////////////Private methods /// <summary> /// Получает коллекцию сохраненных параметров. Только сериализуемые поля /// </summary> /// <param name="setting"></param> /// <returns></returns> private IEnumerable<ParamEntity> GetSavedStrategyParams(DataProvider setting) { IEnumerable<ParamEntity> strategyParams; if (!String.IsNullOrEmpty(setting.StrParams)) { strategyParams = Serializer.Deserialize<List<ParamEntity>>(setting.StrParams); } else strategyParams = new List<ParamEntity>(); return strategyParams; }