My problem is that I have this class:
[SerializableAttribute]
[SoapInclude(typeof(PairColumnValue))]
[XmlInclude(typeof(PairColumnValue))]
public class PairColumnValue:IPairColumnValue
{
public string ColumnName
{
get { return data.Element("ColumnName").Value; }
}
public string Value
{
get { return data.Element("Value").Value; }
}
private XElement data;
public PairColumnValue()
{
data = new XElement("Data", new XElement("ColumnName", ""), new XElement(("Value"), ""));
}
public PairColumnValue(string columnName, string value)
{
data = new XElement("Data", new XElement("ColumnName", columnName), new XElement(("Value"), value));
}
}
That class is used in a WebService, and when I add a reference to the service, the generated reference to the class (Reference.cs) is as it goes:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.4927")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class PairColumnValue {
}
It doesn't have any field, and I cannot use it, why? And more important, what must I do to obtain a class with the fields that I want to use?
PD: in order to use the WebReference, I do the next:
[Test]
public void InsertThroughService()
{
ServiceReference.PairColumnValue[] toInsert = new ServiceReference.PairColumnValue[2];
toInsert[0] = new PruebasUnitarias.ServiceReference.PairColumnValue("login", "testservice");
toInsert[1] = new ServiceReference.PairColumnValue("password", "testservice");
ServiceReference.PersistenceServicev2 client = new PersistenceServicev2();
XmlSerializer serializer = new XmlSerializer(typeof(PairColumnValue));
client.InsertData("usuario", toInsert);
}
And, of course, at the constructors it says "Error, the class doesn't contain a constructor with 2 arguments.
Help! And thanks, for sure!