简体   繁体   中英

Using AutoMapper to map from XElement to a strongly typed class?

Can I use AutoMapper to map from data in an XElement to my own type ? How ?

Yes you can but in any case you will end up writing a function that does the conversion from the non strongly typed XElement to your strongly typed class, so AutoMapper wouldn't bring much value here. You could use ConvertUsing or write a custom ITypeConverter .

you can use ValueInjecter for this, look at this link, it's something similar:

http://valueinjecter.codeplex.com/Thread/View.aspx?ThreadId=218448

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM