public IPropertyMapping GetPropertyMapping(string name, Type owningType = null) { if (owningType == null || owningType == Type) { IPropertyMapping mapping; if (_propertyMappings.TryGetValue(name, out mapping)) { return(mapping); } if (HasSubTypeMappings) { return(null); } } else if (HasSubTypeMappings) { IObjectMapping subTypeMapping; if (SubTypeMappingsTypeDictionary.TryGetValue(owningType, out subTypeMapping)) { return(subTypeMapping.GetPropertyMapping(name)); } } throw new MappingException($"Property mapping with name '{name}' was not found for '{Type.FullName}'"); }
public IPropertyMapping GetPropertyMappingByAttribute(string name, Type owningType = null) { if (owningType == null || owningType == Type) { if (_attributePropertyMappings.TryGetValue(name, out IPropertyMapping mapping)) { return(mapping); } } else if (HasSubTypeMappings) { if (SubTypeMappingsTypeDictionary.TryGetValue(owningType, out IObjectMapping subTypeMapping)) { return(subTypeMapping.GetPropertyMappingByAttribute(name)); } } return(null); }