public string[] GetUnmappedPropertyNames() { var autoMappedProperties = _propertyMaps.Where(pm => pm.IsMapped()) .Select(pm => pm.DestinationProperty.Name); var inheritedProperties = _inheritedMaps.Where(pm => pm.IsMapped()) .Select(pm => pm.DestinationProperty.Name); var properties = _destinationType.GetPublicWriteAccessors() .Select(p => p.Name) .Except(autoMappedProperties) .Except(inheritedProperties); return(properties.Where(memberName => !IgnorePropertiesStartingWith.Any(memberName.StartsWith)).ToArray()); }
private IMappingExpression CreateMappingExpression(TypeMap typeMap, Type destinationType) { IMappingExpression mappingExp = new MappingExpression(typeMap, _serviceCtor); TypeInfo destInfo = new TypeInfo(destinationType); foreach (var destProperty in destInfo.GetPublicWriteAccessors()) { object[] attrs = destProperty.GetCustomAttributes(true); if (attrs.Any(x => x is IgnoreMapAttribute)) { mappingExp = mappingExp.ForMember(destProperty.Name, y => y.Ignore()); } } return(mappingExp); }
private IMappingExpression <TSource, TDestination> CreateMappingExpression <TSource, TDestination>(TypeMap typeMap) { IMappingExpression <TSource, TDestination> mappingExp = new MappingExpression <TSource, TDestination>(typeMap, _serviceCtor, this); // Custom Hack var destInfo = new TypeInfo(typeof(TDestination)); foreach (var destProperty in destInfo.GetPublicWriteAccessors()) { object[] attrs = destProperty.GetCustomAttributes(true); if (attrs.Any(x => x is IgnoreMapAttribute)) { mappingExp = mappingExp.ForMember(destProperty.Name, y => y.Ignore()); } } return(mappingExp); }
public string[] GetUnmappedPropertyNames() { var autoMappedProperties = _propertyMaps.Where(pm => pm.IsMapped()) .Select(pm => pm.DestinationProperty.Name); var inheritedProperties = _inheritedMaps.Where(pm => pm.IsMapped()) .Select(pm => pm.DestinationProperty.Name); IEnumerable <string> properties; if (ConfiguredMemberList == MemberList.Destination) { properties = _destinationType.GetPublicWriteAccessors() .Select(p => p.Name) .Except(autoMappedProperties) .Except(inheritedProperties); } else { var redirectedSourceMembers = _propertyMaps .Where(pm => pm.IsMapped()) .Where(pm => pm.CustomExpression != null) .Where(pm => pm.SourceMember != null) .Select(pm => pm.SourceMember.Name); var ignoredSourceMembers = _sourceMemberConfigs .Where(smc => smc.IsIgnored()) .Select(pm => pm.SourceMember.Name); properties = _sourceType.GetPublicReadAccessors() .Select(p => p.Name) .Except(autoMappedProperties) .Except(inheritedProperties) .Except(redirectedSourceMembers) .Except(ignoredSourceMembers) ; } return(properties.Where(memberName => !IgnorePropertiesStartingWith.Any(memberName.StartsWith)).ToArray()); }
private IMappingExpression <TSource, TDestination> CreateMappingExpression <TSource, TDestination>(TypeMap typeMap) { IMappingExpression <TSource, TDestination> mappingExp = new MappingExpression <TSource, TDestination>(typeMap, _serviceCtor, this); TypeInfo destInfo = typeMap.ConfiguredMemberList == MemberList.Destination ? new TypeInfo(typeof(TDestination)) : new TypeInfo(typeof(TSource)); foreach (var destProperty in destInfo.GetPublicWriteAccessors()) { object[] attrs = destProperty.GetCustomAttributes(true); if (attrs.Any(x => x is IgnoreMapAttribute)) { mappingExp = mappingExp.ForMember(destProperty.Name, y => y.Ignore()); } if (_globalIgnore.Contains(destProperty.Name)) { mappingExp = mappingExp.ForMember(destProperty.Name, y => y.Ignore()); } } return(mappingExp); }