private void LoadConverterParams(Type declaringType) { ChoIniFile iniFile = GetIniSection(declaringType, "FORMATTER"); var dict = new Dictionary <string, object[]>(); string parameters = null; ChoMemberAttribute memberAttribute = null; foreach (MemberInfo memberInfo in ChoType.GetMembers(declaringType)) { memberAttribute = ChoType.GetAttribute <ChoMemberAttribute>(memberInfo); if (memberAttribute == null) { continue; } try { if (_turnOnMetaDataCache) { parameters = iniFile.GetValue(memberInfo.Name); } List <object> p = new List <object>(); if (!parameters.IsNullOrWhiteSpace()) { foreach (string kv in parameters.SplitNTrim(';')) { p.Add(kv.SplitNTrim(',')); } } dict.Add(memberInfo.Name, parameters.IsNullOrWhiteSpace() ? null : p.ToArray()); } catch (Exception ex) { ChoETLFramework.WriteLog(ChoETLFramework.Switch.TraceError, "Failed to retrieve converter params for '{0}' member type from INI file. {1}".FormatString(ChoType.GetMemberName(memberInfo), ex.Message)); } } _converterParams.Add(declaringType, dict); }
private void LoadIsRequireds(Type declaringType) { ChoIniFile iniFile = GetIniSection(declaringType, "REQUIRED"); var dict = new Dictionary <string, bool>(); bool isRequired = false; ChoMemberAttribute memberAttribute = null; foreach (MemberInfo memberInfo in ChoType.GetMembers(declaringType)) { memberAttribute = ChoType.GetAttribute <ChoMemberAttribute>(memberInfo); if (memberAttribute == null) { continue; } try { if (_turnOnMetaDataCache) { isRequired = iniFile.GetValue(memberInfo.Name, memberAttribute.IsRequired, _isLockedCache[declaringType]); } else { isRequired = memberAttribute.IsRequired; } dict.Add(memberInfo.Name, isRequired); } catch (Exception ex) { ChoETLFramework.WriteLog(ChoETLFramework.Switch.TraceError, "Incorrect IsRequired value specified for '{0}' member type in INI file. Defaulted to false. {1}".FormatString(ChoType.GetMemberName(memberInfo), ex.Message)); } } _isReqCache.Add(declaringType, dict); }