G
Guest
To send/receive data to/fro PDA or Web Service, I have created Translation
class which contain collection of objects which I need to transfer from one
end to another.
The web service calls the serialize method of EntityTranslation class to
Serialize the data and the win forms application call the deserialize method
to get the data.
It all works fine in win forms application, problem occurs when I try to
deserialize it from Device Application (Pocket PC). It fails on line
XmlSerializer s = new XmlSerializer(this.GetType());
in the Deseralize method with error
An error message cannot be displayed beacuase an optional resource assembly
containing it cannot be found.
I don't want to use datasets to transfer data from to and from PDA/Web
service as it is not the best approach???
public class EntityTranslation
{
private Lookups lookups = new Lookups();
public Lookups LookupCollection
{
get { return lookups; }
set { lookups = value; }
}
public string Seralize()
{
String strOutput = string.Empty;
XmlSerializer s = new XmlSerializer(this.GetType());
StringWriter strWriter = new StringWriter();
try
{
s.Serialize(strWriter, this);
strOutput = strWriter.ToString();
}
finally
{
strWriter.Close();
}
return strOutput;
}
public static EntityTranslation Deseralize(string xmlString)
{
EntityTranslation etObj = new EntityTranslation();
StringReader strReader = new StringReader(xmlString);
XmlSerializer serializer = new XmlSerializer(etObj.GetType());
try
{
etObj = (EntityTranslation)serializer.Deserialize(strReader);
}
finally
{
strReader.Close();
}
return etObj;
}
}
class which contain collection of objects which I need to transfer from one
end to another.
The web service calls the serialize method of EntityTranslation class to
Serialize the data and the win forms application call the deserialize method
to get the data.
It all works fine in win forms application, problem occurs when I try to
deserialize it from Device Application (Pocket PC). It fails on line
XmlSerializer s = new XmlSerializer(this.GetType());
in the Deseralize method with error
An error message cannot be displayed beacuase an optional resource assembly
containing it cannot be found.
I don't want to use datasets to transfer data from to and from PDA/Web
service as it is not the best approach???
public class EntityTranslation
{
private Lookups lookups = new Lookups();
public Lookups LookupCollection
{
get { return lookups; }
set { lookups = value; }
}
public string Seralize()
{
String strOutput = string.Empty;
XmlSerializer s = new XmlSerializer(this.GetType());
StringWriter strWriter = new StringWriter();
try
{
s.Serialize(strWriter, this);
strOutput = strWriter.ToString();
}
finally
{
strWriter.Close();
}
return strOutput;
}
public static EntityTranslation Deseralize(string xmlString)
{
EntityTranslation etObj = new EntityTranslation();
StringReader strReader = new StringReader(xmlString);
XmlSerializer serializer = new XmlSerializer(etObj.GetType());
try
{
etObj = (EntityTranslation)serializer.Deserialize(strReader);
}
finally
{
strReader.Close();
}
return etObj;
}
}