Skip to content

Instantly share code, notes, and snippets.

@DavidDeSloovere
Created August 20, 2014 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidDeSloovere/35348919f7622bfc0546 to your computer and use it in GitHub Desktop.
Save DavidDeSloovere/35348919f7622bfc0546 to your computer and use it in GitHub Desktop.
AutoMapperConfiguration Put AutoMapperConfiguration.Configure(); in global.asax
public static class AutoMapperConfiguration
{
public static void Configure()
{
Mapper.CreateMap<OriginalEntity, DtoEntity>()
.ForMember(dest => dest.EntityId, source => source.MapFrom(s => s.Id));
}
}
[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