返回列表<>我在Webserivce中的数据类型 [英] Returning List<> of my Data type in Webserivce

查看:68
本文介绍了返回列表<>我在Webserivce中的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Asp.net 3.5上使用网络服务。 


我希望在客户端应用程序调用方法时返回我的数据类型列表

我该怎么办? 



binyam

解决方案

如果您正在使用WCF服务,您可以尝试这样的事情:


 ///< summary> 
///获取实体列表。
///< / summary>
///< param name =" EntityName">实体的名称。< / param>
///< returns>< / returns>
[OperationContract]
[WebGet(UriTemplate =" / Entity / {EntityName}")]
IList< Entity> GetMyEntity(string EntityName);


I'm using web service on Asp.net 3.5. 

I want to return list of my data type when the method call from client application 

what shall I do? 


binyam

解决方案

If you are using WCF service you can just try something like this:

/// <summary>
        /// Get Entity list.
        /// </summary>
        /// <param name="EntityName">Name of the entity.</param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(UriTemplate = "/Entity/{EntityName}")]
        IList<Entity> GetMyEntity(string EntityName);


这篇关于返回列表&lt;&gt;我在Webserivce中的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆