It seems that you can add name attribute in the DataContract attribute and set its namespace to empty string, and also add name attribute to the DataMember attribute. something as follows:
[DataContract(Name = "listaActos", Namespace = "")]
public class listaActos
{
[DataMember(Order = 0, Name = "odigoActo")]
public string codigoActo { get; set; }
neko_zgz
0 Points
4 Posts
WCF Data serialization
May 11, 2012 03:42 PM|LINK
Working with WCF how it should modify this DataContract or code:
<DataContract()>
Public Class listaActos
Private _codigoActo As List(Of String)
<DataMember(IsRequired:=True)>
Public Property codigoActo() As List(Of String)
Get
Return _codigoActo
End Get
Set(ByVal value As List(Of String))
_codigoActo = value
End Set
End Property ...
which generates following response xml when serializing:
<a:listaActos>
<a:codigoActo xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<b:string>01672</b:string>
</a:codigoActo>
</a:listaActos>
but I want to bo as follows:
<a:listaActos>
<a:codigoActo>01672</a:codigoActo>
<a:codigoActo>01673</a:codigoActo>
<a:codigoActo>01674</a:codigoActo>
</a:listaActos>
Thanks in advance!!
serialization WCF
Peter pi - M...
Star
12871 Points
1786 Posts
Re: WCF Data serialization
May 14, 2012 02:27 AM|LINK
It seems that you can add name attribute in the DataContract attribute and set its namespace to empty string, and also add name attribute to the DataMember attribute. something as follows:
[DataContract(Name = "listaActos", Namespace = "")]
public class listaActos
{
[DataMember(Order = 0, Name = "odigoActo")]
public string codigoActo { get; set; }
public listaActos(){}
}
Here is a post to which you can refer.
http://stackoverflow.com/questions/1644004/how-do-i-add-an-xml-attribute-using-datacontract
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework