Created
August 11, 2017 17:43
-
-
Save lbargaoanu/8716aedde92f4ff98c2c57d41da1e5a1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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() | |
{ | |
Mapper.Initialize(cfg => | |
{ | |
cfg.CreateMap<Source, Destination>(); | |
cfg.CreateMap<Source, IDestination>().As<Destination>(); | |
}); | |
Mapper.AssertConfigurationIsValid(); | |
Mapper.Map<IDestination>(new Source { Value = Guid.NewGuid().ToString(), TypedValue = Guid.NewGuid() }).Dump(); | |
} | |
class Source | |
{ | |
public string Value; | |
public Guid? TypedValue; | |
} | |
class Destination : IDestination | |
{ | |
public Guid? Value { get; set; } | |
public string TypedValue { get; set; } | |
} | |
interface IDestination | |
{ | |
Guid? Value { get; set; } | |
string TypedValue { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment