public void MapFrom <TSourceMember>(IMemberValueResolver <TSource, TDestination, TSourceMember, TMember> valueResolver, Expression <Func <TSource, TSourceMember> > sourceMember) { var config = new ValueResolverConfiguration(valueResolver, typeof(IMemberValueResolver <TSource, TDestination, TSourceMember, TMember>)) { SourceMember = sourceMember }; PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); }
public void MapFrom <TSource, TDestination, TSourceMember, TDestMember>(IMemberValueResolver <TSource, TDestination, TSourceMember, TDestMember> resolver, string sourceMemberName) { var config = new ValueResolverConfiguration(resolver, typeof(IMemberValueResolver <TSource, TDestination, TSourceMember, TDestMember>)) { SourceMemberName = sourceMemberName }; PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); }
public UserProfile(IMemberValueResolver <object, object, ICollection <Image>, string> custom) { // create user map CreateMap <ApplicationUser, UserDto>() .ForMember(destination => destination.UserName, options => options.MapFrom(source => source.UserName)) .ForMember(destination => destination.EmailAddress, options => options.MapFrom(source => source.Email)) .ForMember(destination => destination.AvatarUrl, options => options.ResolveUsing(custom, x => x.ProfileInfo.ProfileImages)); }
public TraceProfile(IMemberValueResolver <object, object, Trace, string> custom) { CreateMap <Trace, TraceViewModel>() .ForMember(destination => destination.Duration, options => options.MapFrom( source => source.CallDuration)) .ForMember(destination => destination.Timestamp, options => options.MapFrom( source => source.RequestTimestamp.ToString(CultureInfo.InvariantCulture))) .ForMember(destination => destination.Uri, options => options.MapFrom(source => source.Url)) .ForMember(destination => destination.Workflow, options => options.ResolveUsing(custom, x => x)); }
public void ResolveUsing <TSource, TDestination, TSourceMember, TDestMember>(IMemberValueResolver <TSource, TDestination, TSourceMember, TDestMember> resolver, string memberName) { var config = new ValueResolverConfiguration(resolver) { SourceMemberName = memberName }; PropertyMapActions.Add(pm => pm.ValueResolverConfig = config); }
public void ResolveUsing <TSource, TDestination, TSourceMember, TDestMember>(IMemberValueResolver <TSource, TDestination, TSourceMember, TDestMember> resolver, string memberName) { var config = new ValueResolverConfiguration(resolver, typeof(IMemberValueResolver <TSource, TDestination, TSourceMember, TDestMember>)) { SourceMemberName = memberName }; PropertyMapActions.Add(pm => { pm.Ignored = false; pm.ValueResolverConfig = config; }); }