Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error in AutoMapper
Message
De
17/08/2014 03:48:26
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Programmation orienté objet
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01605838
Message ID:
01605939
Vues:
52
This message has been marked as the solution to the initial question of the thread.
>>I've never used AutoMapper but you seem to be mapping from a small object to a larger one with additional properties - do you have it the wrong way around ?
>>Or do you have some rule in the map which tells it how to populate ItemType ?
>
>In order to resolve that problem I had to add ItemType to the model as well.

Adding a member to the source to get round the problem doesn't sound right. Would adding the
.ForMember(dest => dest.ItemType, opt => opt.Ignore());
to your CreateMap method work instead ?

> I don't know why all other properties were successfully ignored in run-time and this one caused troubles.

Don't know why either. If you try 'Mapper.AssertConfigurationIsValid();' I think you will find that it will complain about all unmapped members in the destination class.

Can you post the two class definition :?

Update: I see in the original exception a 'ItemType.ItemType' and there is an ItemType property in C# RepeaterItem. Maybe AutoMapper is confused by this. Do you get the exception if you change the name ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform