public String GetRegistrationName(TypeMapping typeMapping) { var namedMappingRequested = configurationDetails.IsMultimap(typeMapping.From) || configurationDetails.IsNamedMapping(typeMapping.To); var namedMappingRequired = mappingBehaviors.HasFlag(MappingBehaviors.MultimapByDefault) && multimapTypes.Contains(typeMapping.From); return((namedMappingRequested || namedMappingRequired) ? configurationDetails.GetNamedMapping(typeMapping) : null); }
private static IEnumerable <TypeMapping> CreateAcrMappings(IEnumerable <TypeMapping> mappings, AutomapperConfig configurationDetails) { Contract.Requires(mappings != null); return(mappings .GroupBy(m => m.From) .Where(g => g.Count() > 1 || configurationDetails.IsMultimap(g.Key)) .Select(g => new TypeMapping(GetGenericTypeSafely(typeof(IEnumerable <>), g.Key), GetGenericTypeSafely(typeof(UnityCollectionFacade <>), g.Key)))); }
private static IEnumerable<TypeMapping> CreateAcrMappings(IEnumerable<TypeMapping> mappings, AutomapperConfig configurationDetails) { Contract.Requires(mappings != null); return mappings .GroupBy(m => m.From) .Where(g => g.Count() > 1 || configurationDetails.IsMultimap(g.Key)) .Select(g => new TypeMapping(GetGenericTypeSafely(typeof(IEnumerable<>), g.Key), GetGenericTypeSafely(typeof(UnityCollectionFacade<>), g.Key))); }
public void ValidateTypeMapping(TypeMapping mapping) { var usingMultimapping = mappingBehaviors.HasFlag(MappingBehaviors.MultimapByDefault) || configurationDetails.IsMultimap(mapping.From); if (!usingMultimapping) { CheckForExistingTypeMapping(target, mapping); } CheckForExistingNamedMapping(target, mapping, configurationDetails); }