数组,而不是名单WCF服务代理使用svcutil.exe的生成

编程入门 行业动态 更新时间:2024-10-25 09:23:45
本文介绍了数组,而不是名单WCF服务代理使用svcutil.exe的生成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个的ServiceContract ,

using System.Collections.Generic; using System.ServiceModel; namespace MainModule.Sub.Communication { [ServiceContract] public interface IWebMethod { [OperationContract(IsOneWay = false)] bool InvokeAlert(List<int> userIds); [OperationContract(IsOneWay = false, Name = "InvokeAlertByMainID")] bool InvokeAlert(List<int> userIds, int mainId); [OperationContract(IsOneWay = true)] void DeletePopupNotifications(System.Data.DataSet deletedNotifications); } }

我用下面的命令生成代理(我要做到这一点使用命令行通过不添加服务引用。

SvcUtil.exe localhost/MainCommunicationServer/wm /ct:System.Collections.Generic.List`1 /out:HTTPRouterServerProxy.cs

即使我增加了克拉开关(collectionType)的代理生​​成它作为阵列( INT [] ) 。我怎么能做到这一点,而无需使用添加服务引用窗口,在VS

Even I added the ct switch (collectionType) the proxy is Generating it as Array (int[]). How can I do that without using Add Service Reference window in VS

推荐答案

如果我没有记错,在/ CT开关可能没有任何影响(在某些情况下?)。尝试使用包装DataContract类型,例如布尔InvokeAlert(InvokeAlertRequest R); ,其中 InvokeAlertRequest 将是 [DataContract] 包含一个 [数据成员]列表与LT型; INT&GT;用户id;

If I remember correctly, the /ct switch may not have any effect (in some circumstances?) on OperationContract-level collections. Try using a wrapper DataContract type, e.g. bool InvokeAlert(InvokeAlertRequest r); where InvokeAlertRequest will be a [DataContract] type containing one [DataMember] List<int> userIds;

更多推荐

数组,而不是名单WCF服务代理使用svcutil.exe的生成

本文发布于:2023-11-05 07:37:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560262.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   而不是   名单   exe   svcutil

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!