Ejemplo n.º 1
0
        private void UpdateIfExpressionDoesNotExist(Type sourceType, Type destinationType)
        {
            UpdateDictionaryHolder(sourceType, destinationType);
            var properyMappings = _sourceToDestPropMaps[sourceType][destinationType];

            if (properyMappings != null)
            {
                return;
            }

            try
            {
                var keyProperties = _generatePropertyMaps.GeneratePropertyMaps(sourceType, destinationType);
                if (!keyProperties.Any())
                {
                    _sourceToDestPropMaps[sourceType][destinationType] = GenerateEquivilentExpressions.BadValue;
                }
                else
                {
                    _sourceToDestPropMaps[sourceType][destinationType] = new GenerateEquivilentExpressionOnPropertyMaps(keyProperties);
                }
            }
            catch (Exception ex)
            {
                _sourceToDestPropMaps[sourceType][destinationType] = GenerateEquivilentExpressions.BadValue;
            }
        }
Ejemplo n.º 2
0
 private IGenerateEquivilentExpressions GetPropertyMatches(Type sourceType, Type destinationType)
 {
     return(_sourceToDestPropMaps
            .GetOrAdd(sourceType, t => new ConcurrentDictionary <Type, IGenerateEquivilentExpressions>())
            .GetOrAdd(destinationType, t =>
     {
         try
         {
             var keyProperties = _generatePropertyMaps.GeneratePropertyMaps(sourceType, destinationType);
             return keyProperties.Any() ? new GenerateEquivilentExpressionOnPropertyMaps(keyProperties) : GenerateEquivilentExpressions.BadValue;
         }
         catch (Exception)
         {
             return GenerateEquivilentExpressions.BadValue;
         }
     }));
 }