界面
[ServiceContract]
public interface Idemo
{
[OperationContract]
[WebGet(UriTemplate = "check?Value1={id}&Value2={name}&Value3={city}",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare)]
string GetData(string id,string name);
}
班级
public class demo : Idemo
{
public string GetData(string id,string name,string city)
{
DataTable tb;
tb = con.GetDataTable("query");
tb.TableName = "data";
System.IO.StringWriter writer = new System.IO.StringWriter();
tb.WriteXml(writer, XmlWriteMode.IgnoreSchema, false);
return writer.ToString();
}
}
返回表如下所示
sem sub1 sub2 sub3
1 50 40 30
2 60 20 40
界面设计好不好?我没有使用任何合同。有没有其他加快速度的方法?
我听说将 DataSet 转换为自定义 DataContract 并发送它..在我的场景中可能吗?