如何将[XmlElement(DataType =“date”)]与WebService的WebMethod属性一起使用

时间:2021-05-01 20:09:23

My Web Service Signature is

我的Web服务签名是

[WebMethod]
public DataSet GetPatientLastWeighing(int pFacilityID,string pSessionID)
{
}

1 个解决方案

#1


You don't have much control over DataSet/DataTable serialization. IMO, the best answer here is: don't use DataSet/DataTable on web-services. Personally, I'd declare a class with the properties I need, attribute them as I like, and return an array (T[]) or List<T> of that type.

您无法控制DataSet / DataTable序列化。 IMO,这里最好的答案是:不要在Web服务上使用DataSet / DataTable。就个人而言,我将声明一个具有我需要的属性的类,根据我的喜好对它们进行属性化,并返回该类型的数组(T [])或List

Far cleaner, you have more control over the xml, and it is usable from different types of client (not just .NET).

更清洁,你可以更好地控制xml,它可以从不同类型的客户端(不仅仅是.NET)使用。

#1


You don't have much control over DataSet/DataTable serialization. IMO, the best answer here is: don't use DataSet/DataTable on web-services. Personally, I'd declare a class with the properties I need, attribute them as I like, and return an array (T[]) or List<T> of that type.

您无法控制DataSet / DataTable序列化。 IMO,这里最好的答案是:不要在Web服务上使用DataSet / DataTable。就个人而言,我将声明一个具有我需要的属性的类,根据我的喜好对它们进行属性化,并返回该类型的数组(T [])或List

Far cleaner, you have more control over the xml, and it is usable from different types of client (not just .NET).

更清洁,你可以更好地控制xml,它可以从不同类型的客户端(不仅仅是.NET)使用。