Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AutoMapper throws an error - how to figure out?
Message
 
 
À
12/05/2016 14:26:02
Information générale
Forum:
ASP.NET
Catégorie:
Produits tierce partie
Versions des environnements
Environment:
C# 5.0
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01636216
Message ID:
01636301
Vues:
40
How can I make AutoMapper ignore our BaseClass ViewModel properties?

I added the following
public class AutoMapperConfig
    {
        public static MapperConfiguration mapperConfiguration = new MapperConfiguration(cfg =>
        {
            cfg.AddProfile(new MappingProfile());
            cfg.ShouldMapProperty = pi => !pi.Name.InList( "HiddenSwitch","ErrorMessage","SuccessMessage", "WarningMessage","DuplicateForm"); // this is the line I added
        });
        public static IMapper Mapper;

        public static void Configure()
        {
            Mapper = mapperConfiguration.CreateMapper();
            mapperConfiguration.AssertConfigurationIsValid(); // This line I added
        }
    }
But I still got these properties listed as unmapped.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform