Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi. I noticed your article on Automapper which is very good. Thanks for that. I do have a question. I am trying to map a class which has an identical layout and signature to the class I am trying to map to. All goes well and simple except when I try to map Object collections. For example when I try to map this property defined in the class:

C#
[System.Xml.Serialization.XmlElementAttribute("transaction_history", typeof(TransactionHistory))]
[System.Xml.Serialization.XmlElementAttribute("transfer_value_split", typeof(TransferValueSplit))]
[System.Xml.Serialization.XmlElementAttribute("trust", typeof(Trust))]
[System.Xml.Serialization.XmlElementAttribute("valuation", typeof(Valuation))]
[System.Xml.Serialization.XmlElementAttribute("waiver_of_premium_ind", typeof(YesNo))]
[System.Xml.Serialization.XmlElementAttribute("written_under_trust_ind", typeof(YesNo), IsNullable = true)]
[System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")]
public object[] Items
{//You need to add XmlChoiceIdentifierAttribute
    get
    {
        return this.itemsField;
    }
    set
    {
        this.itemsField = value;
    }
}


I find that it does not map but remains in the same namespace as the source object.
I wonder if you have any ideas on this matter.
Thanks,
Michael

[removed personal e-mail address - wizardzz]
Posted
Updated 22-Mar-12 9:09am
v2
Comments
Shahin Khorshidnia 22-Mar-12 13:11pm    
What article?

1 solution

I think it would be in your best interest to post a question like this to the original article. It will give the author of the article and code an opportunity to see the question and respond to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900