Skip to content

Instantly share code, notes, and snippets.

@lbargaoanu
Created October 30, 2015 09:32
Show Gist options
  • Save lbargaoanu/fbfabe9f5fdba6703374 to your computer and use it in GitHub Desktop.
Save lbargaoanu/fbfabe9f5fdba6703374 to your computer and use it in GitHub Desktop.
void Main()
{
Mapper.CreateMap<Source, DestinationBase>().ForAllMembers(e => e.Ignore());
Mapper.CreateMap<Source, Destination>().IncludeBase<Source, DestinationBase>();
Mapper.Configuration.Seal();
Mapper.AssertConfigurationIsValid();
Mapper.Map<Destination>(new Source { Value = 3 }).Dump();
}
public class DestinationBase
{
public int AnotherValue { get; set; }
}
public class Destination : DestinationBase
{
public int Value { get;set; }
}
public class Source
{
public int Value { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment