Created
August 20, 2014 13:19
-
-
Save DavidDeSloovere/35348919f7622bfc0546 to your computer and use it in GitHub Desktop.
AutoMapperConfiguration Put AutoMapperConfiguration.Configure(); in global.asax
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
public static class AutoMapperConfiguration | |
{ | |
public static void Configure() | |
{ | |
Mapper.CreateMap<OriginalEntity, DtoEntity>() | |
.ForMember(dest => dest.EntityId, source => source.MapFrom(s => s.Id)); | |
} | |
} |
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
[TestClass] | |
public class AutoMapperConfigurationTest | |
{ | |
[TestMethod] | |
public void AssertConfigurationIsValid() | |
{ | |
AutoMapperConfiguration.Configure(); | |
Mapper.AssertConfigurationIsValid(); | |
} | |
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "useless")] | |
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] | |
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | |
private void FakeMethodToMakeSureAutomapperNet4IsReferenced() | |
{ | |
var useless = new ListSourceMapper(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment