Skip to content

Release 1.0.5 #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<Authors>Jimmy Bogard</Authors>
<LangVersion>latest</LangVersion>
<VersionPrefix>1.0.5-preview02</VersionPrefix>
<VersionPrefix>1.0.5</VersionPrefix>
<WarningsAsErrors>true</WarningsAsErrors>
<NoWarn>$(NoWarn);1701;1702;1591</NoWarn>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,19 @@ void CallSomeAction<T>(T val)
{
this.val = val;
}

[Fact]
public void Can_map_expression_when_mapped_properties_have_a_different_generic_argument_counts()
{
//Arrange
Expression<Func<ListParent, bool>> src = x => x.List.Count == 0;

//Act
Expression<Func<ListParentExtension, bool>> dest = mapper.Map<Expression<Func<ListParentExtension, bool>>>(src);

//Assert
Assert.NotNull(dest);
}
#endregion Tests

private static void SetupAutoMapper()
Expand Down Expand Up @@ -1018,6 +1031,20 @@ class ItemEntity
public string Name { get; set; }
}

class ListParentExtension
{
public ListExtension List { get; set; }
}

class ListParent : List<string>
{
public List<string> List { get; set; }
}

class ListExtension : List<string>
{
}

public class OrganizationProfile : Profile
{
public OrganizationProfile()
Expand Down Expand Up @@ -1112,6 +1139,13 @@ public OrganizationProfile()

CreateMap<OptionT, OptionS>();

CreateMap<ListParentExtension, ListParent>()
.ReverseMap();
CreateMap<ListExtension, List<string>>()
.ForMember(d => d.Count, opt => opt.MapFrom(s => s.Count))
.ReverseMap()
.ForMember(d => d.Count, opt => opt.MapFrom(s => s.Count));

CreateMissingTypeMaps = true;
}
}
Expand Down