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); }
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); }
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); }