Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AutoMapper - how to map 2 same complex classes?
Message
 
 
À
25/11/2014 18:39:00
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01611430
Message ID:
01611465
Vues:
30
>Can you share the solution?
>
>>Never mind, solved the problem.

The class had several simple properties and a list of a different class. All I needed to do is to add a map for that class as well, e.g. these 4 lines were enough:
Mapper.CreateMap<InvoicesToPayViewModel, InvoicesToPay>();
            Mapper.CreateMap<InvoicesToPay, InvoicesToPayViewModel>();
            Mapper.CreateMap<TransactionObjectViewModel, TransactionObject>();
            Mapper.CreateMap<TransactionObject, TransactionObjectViewModel>();
My original try was just 2 last lines and therefore it was failing.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform