通过 Azure 服务总线发送对象列表
我正在尝试通过 Azure 服务总线发送对象列表,并想检查这是否是正确的方法。最初我尝试发送:
IEnumerable<Product>
侦听器端点在集合中有产品对象,但是当它到达调用端点时,计数为 0。列表也是如此(我期望的),
我已经通过使用
List<BrokeredMessage> messages = new List<BrokeredMessage>();
foreach (BcsProduct product in products)
{
BcsProduct p = new BcsProduct { ProductId = product.ProductId, Name = product.Name };
messages.Add(new BrokeredMessage(p));
}
我想要的 BrokeredMessage 列表使其工作检查这是正确的方法,或者 IEnumerable 是否应该工作
谢谢尼克
......
I'm trying to send a list of objects over the Azure service bus, and want to check this is the correct way to do it. Intially I tried sending:
IEnumerable<Product>
The Listener endpoint had product objects in the collection, but when it got to the calling endpoint the count was 0. Same for List (which I expected)
I've got it working by using List of BrokeredMessage
List<BrokeredMessage> messages = new List<BrokeredMessage>();
foreach (BcsProduct product in products)
{
BcsProduct p = new BcsProduct { ProductId = product.ProductId, Name = product.Name };
messages.Add(new BrokeredMessage(p));
}
I wanted to check this was the correct approach, or if IEnumerable should work...
Thanks
Nick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看到你已经找到答案了,但你可以简化你的代码:
See you have already found the answer, but you could simplifly your code: