Last active
September 21, 2016 15:02
-
-
Save bondsbw/5e5b70873a7b67fe281efceade2a7e25 to your computer and use it in GitHub Desktop.
Automapper missing map exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var profile = new MyProfile(); | |
Mapper.Initialize(cfg => cfg.AddProfile(profile)); | |
} | |
public class MyProfile : Profile | |
{ | |
protected override void Configure() | |
{ | |
CreateMap<Base, string>() | |
.Include<Derived, string>() | |
.ConvertUsing(src => src == null ? null : src.Value); | |
} | |
} | |
public class Base | |
{ | |
public string Value { get; set; } | |
} | |
public class Derived : Base | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment