Ejemplo n.º 1
0
        /// <inheritdoc/>
        bool IHalRepository.TryGetTransformer(Type type, [MaybeNullWhen(returnValue: false)] out ITypeTransformer transformer)
        {
            if (!_transformations.TryGetValue(type, out var transformationMap))
            {
                transformer = default;
                return(false);
            }

            transformer = new TypeTransformer(transformationMap, _serviceProvider);
            return(true);
        }
Ejemplo n.º 2
0
        public TypeTransformerRepository WithTypeTransformer <T1, T2>
        (
            [NotNull] Type type,
            [NotNull] ITypeTransformer <T1, T2> transformer
        )
        {
            if (!_typeTransformers.ContainsKey(type))
            {
                _typeTransformers.Add(type, transformer);
            }

            return(this);
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        bool IHalRepository.TryGetTransformer(Type type, out ITypeTransformer transformer)
        {
            if (type is null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (!_transformations.TryGetValue(type, out var transformationMap))
            {
                transformer = default;
                return(false);
            }

            transformer = new TypeTransformer(transformationMap, _serviceProvider);
            return(true);
        }