ASP.net web method:
[WebMethod()]
public Data.Subtitle[] GetAll()
{
return Data.Subtitle.FindAll();
}
Here's the Subtitle class:
[ActiveRecord("Subtitle")]
public class Subtitle : ActiveRecordBase<Subtitle>
{
[PrimaryKey(PrimaryKeyType.Assigned)]
public int SubId {get;set;}
[Property()]
public int SubStreamId {get;set;}
[Property()]
public string SubTimeStart {get;set;}
[Property()]
public string SubTimeEnd {get;set;}
[Property()]
public string SubText {get;set;}
public Subtitle () { }
}
And here's the XML coming back:
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSubtitle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Subtitle>
<SubId>862</SubId>
<SubStreamId>1</SubStreamId>
<SubTimeStart>00:01:04.4450000</SubTimeStart>
<SubTimeEnd>00:01:08.2450000</SubTimeEnd>
<SubText>Wikus van de Merwe
MNU Alien Affairs
</SubText>
</Subtitle>
<Subtitle>
<SubId>863</SubId>
<SubStreamId>1</SubStreamId>
<SubTimeStart>00:02:11.3430000</SubTimeStart>
<SubTimeEnd>00:02:14.8430000</SubTimeEnd>
<SubText>Sarah Livingstone
Sociologist, Kempton Park University
</SubText>
</Subtitle>
I love the simplicity of presenting the data objects as a webservice with one line of code, but I can't seem to get the array of Subtitle
objects serialized without the "ArrayOf" prefix. My trips through Google have pointed me to WCF facilities that aren't available on Mono, or manual serialization, which I am trying to avoid.
Is there an easy way to present the array of Subtitle objects as <Subtitles>
in Mono?