public virtual FieldMapping FindFieldMapping(string fieldName) { if (!_fieldMappingAllNameDictionary.ContainsKey(fieldName)) { lock (_fieldMappingAllNameDictionary) { if (!_fieldMappingAllNameDictionary.ContainsKey(fieldName)) { FieldMapping mapping = SearchFieldMapping(fieldName); if (mapping != null) { _fieldMappingAllNameDictionary[fieldName] = mapping; } return(mapping); } } } return(_fieldMappingAllNameDictionary[fieldName]); }
public FieldMapping FindFieldMapping(string fieldName) { if (_fieldMappingDictionary.ContainsKey(fieldName)) { FieldMapping m = _fieldMappingDictionary [fieldName]; if (m is PrimitiveFieldMapping || m is EnumFieldMapping) { return(m); } } if (_fieldMappingAlterNameDictionary.ContainsKey(fieldName)) { FieldMapping m = _fieldMappingAlterNameDictionary [fieldName]; if (m is PrimitiveFieldMapping || m is EnumFieldMapping) { return(m); } } foreach (KeyValuePair <string, FieldMapping> kv in _fieldMappingDictionary) { if (fieldName.StartsWith(kv.Key + "_") && kv.Value is ComplexFieldMapping) { return(((ComplexFieldMapping)kv.Value).FindFieldMapping(fieldName)); } } foreach (KeyValuePair <string, FieldMapping> kv in _fieldMappingAlterNameDictionary) { if (fieldName.StartsWith(kv.Key + "_") && kv.Value is ComplexFieldMapping) { return(((ComplexFieldMapping)kv.Value).FindFieldMapping(fieldName)); } } return(null); }