public void Apply(ITransformConfigurator <TInput> configurator)
        {
            var inputPropertyProvider = new InputPropertyProvider <TInput, MessageData <TValue> >(_property);

            var provider = new GetMessageDataPropertyProvider <TInput, TValue>(inputPropertyProvider, _repository);

            configurator.Set(_property, provider);
        }
예제 #2
0
        public void Apply(ITransformConfigurator <TInput> configurator)
        {
            if (_transformConfigurator.TryGetConverter(out var converter))
            {
                var inputPropertyProvider = new InputPropertyProvider <TInput, TProperty>(_property);

                var provider = new PropertyConverterPropertyProvider <TInput, TProperty, TProperty>(converter, inputPropertyProvider);

                configurator.Transform(_property, provider);
            }
        }
        public void Apply(ITransformConfigurator <TInput> configurator)
        {
            if (TypeMetadataCache <TInput> .IsValidMessageType)
            {
                var inputPropertyProvider = new InputPropertyProvider <TInput, MessageData <TValue> >(_property);

                var provider = new PutMessageDataPropertyProvider <TInput, TValue>(inputPropertyProvider, _repository);

                configurator.Set(_property, provider);
            }
        }
        public void Apply(ITransformConfigurator <TInput> configurator)
        {
            if (_transformConfigurator.TryGetConverter(out var converter))
            {
                var inputPropertyProvider = new InputPropertyProvider <TInput, TProperty>(_property);

                var dictionaryConverter = new DictionaryPropertyConverter <TKey, TValue, TValue>(converter) as IPropertyConverter <TProperty, TProperty>;

                var provider = new PropertyConverterPropertyProvider <TInput, TProperty, TProperty>(dictionaryConverter, inputPropertyProvider);

                configurator.Set(_property, provider);
            }
        }
예제 #5
0
        public void Apply(ITransformConfigurator <TInput> configurator)
        {
            if (_transformConfigurator.TryGetConverter(out var converter))
            {
                var inputPropertyProvider = new InputPropertyProvider <TInput, TProperty>(_property);

                IPropertyConverter <TProperty, TProperty> arrayConverter = typeof(TProperty).IsArray
                    ? new ArrayPropertyConverter <TElement, TElement>(converter) as IPropertyConverter <TProperty, TProperty>
                    : new ListPropertyConverter <TElement, TElement>(converter) as IPropertyConverter <TProperty, TProperty>;

                var provider = new PropertyConverterPropertyProvider <TInput, TProperty, TProperty>(arrayConverter, inputPropertyProvider);

                configurator.Transform(_property, provider);
            }
        }
예제 #6
0
        public void Set <TProperty>(Expression <Func <TMessage, TProperty> > propertyExpression,
                                    Func <TransformPropertyContext <TProperty, TMessage>, TProperty> valueProvider)
        {
            var propertyInfo = propertyExpression.GetPropertyInfo();

            var inputValueProvider = new InputPropertyProvider <TMessage, TProperty>(propertyInfo);

            Task <TProperty> PropertyProvider(TransformPropertyContext <TProperty, TMessage> context)
            {
                return(Task.FromResult(valueProvider(context)));
            }

            var propertyProvider = new DelegatePropertyProvider <TMessage, TProperty>(inputValueProvider, PropertyProvider);

            var initializer = new ProviderPropertyInitializer <TMessage, TMessage, TProperty>(propertyProvider, propertyInfo);

            _convention.Add(propertyInfo.Name, initializer);
        }