Esempio n. 1
0
        public ISourcedDestinationConfiguration <TDest> Unflattening <TSource>(Expression <Func <TDest, object> > destinationProperty)
        {
            var mappableDestinationProperty = MappableProperty.For(destinationProperty);

            inner.SetPropertyResolver(PropertyNameCriterion.From(destinationProperty),
                                      typeof(TSource),
                                      new UnflatteningConfigurationResolver(mappableDestinationProperty.PropertyType));
            return(this);
        }
Esempio n. 2
0
        public ISourcedDestinationConfiguration <TDest> Redirecting <TSource, TNest>(
            Expression <Func <TSource, object> > sourceProperty, Expression <Func <TDest, object> > destinationProperty,
            Action <ISourcedDestinationConfiguration <TNest> > nestedCfg)
        {
            var mappableSourceProperty = MappableProperty.For(sourceProperty);
            var newNestedConfig        = configurations.Create <TNest>();
            var sourced = newNestedConfig.From(mappableSourceProperty.PropertyType);

            nestedCfg(sourced);
            inner.SetPropertyResolver(PropertyNameCriterion.From(destinationProperty),
                                      typeof(TSource),
                                      new RedirectingConfigurationResolver(mappableSourceProperty,
                                                                           configurations.CreateBindableConfiguration(newNestedConfig.TakeSnapshot())));
            return(this);
        }
Esempio n. 3
0
        public ISourcedDestinationConfiguration <TDest> Redirecting <TSource>(
            Expression <Func <TSource, object> > sourceProperty, Expression <Func <TDest, object> > destinationProperty)
        {
            var mappableDestinationProperty = MappableProperty.For(destinationProperty);
            var mappableSourceProperty      = MappableProperty.For(sourceProperty);

            if (mappableDestinationProperty.IsCustomType)
            {
                var nestedConfig = configurations.Create(mappableDestinationProperty.PropertyType);
                nestedConfig.From(mappableSourceProperty.PropertyType);
                inner.SetPropertyResolver(PropertyNameCriterion.From(destinationProperty),
                                          typeof(TSource),
                                          new RedirectingConfigurationResolver(MappableProperty.For(sourceProperty),
                                                                               configurations.CreateBindableConfiguration(nestedConfig.TakeSnapshot())));
            }
            else
            {
                inner.SetPropertyResolver(PropertyNameCriterion.From(destinationProperty), typeof(TSource),
                                          new PropertyNameResolver(Reflect.GetProperty(sourceProperty).Name));
            }

            return(this);
        }