Пример #1
0
        /// <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;
        }
Пример #2
0
        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;
        }
Пример #3
0
        //////////////////////////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;
        }