Created
June 20, 2011 19:53
-
-
Save darrencauthon/1036421 to your computer and use it in GitHub Desktop.
AutoMapperAssist example
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
private class ProductViewMapper : Mapper<Product, ProductView> | |
{ | |
public override void DefineMap(IConfiguration configuration) | |
{ | |
configuration.CreateMap<Product, ProductView>() | |
.ForMember(dest => dest.Name, opt => opt.MapFrom(orig => orig.Name + "WHOOPS")); | |
} | |
} |
Right, I've used automapper on another project, but found the assist in nuget. Thanks a bunch!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The IConfiguration argument to DefineMap is AutoMapper's, so you can create any type of mapping you want.
Sometimes I use it to create mappings for child objects, if I have complex trees.