ADO.Net 数据服务操作:整数数组作为参数

发布于 2024-08-08 01:29:05 字数 492 浏览 1 评论 0原文

这个问题有点像.Net 数据服务的两个部分。这是我想要实现的函数签名:

/// <summary>
/// Returns Descriptions for any asset in the given assetIDs.
/// </summary>
[WebGet]
public IQueryable<Description> FindDescriptionForAssets(int[] assetIDs);
  1. 我正在尝试在 ADO.Net 数据服务上创建一个自定义服务操作,该操作将整数数组作为参数。我的理解是,ADO.Net 数据服务不能接受数组(或列表或其他可枚举)作为参数。这是真的吗?有什么办法可以解决这个问题吗?

  2. 看起来使用这样的数组可以通过使用 .Net RIA 服务的 DomainService 来实现。但是,我还没有找到任何证明它的例子。任何人都可以确认这一点吗?

This question is a bit of a two parter for .Net data services. This is the function signature I'm trying to achieve:

/// <summary>
/// Returns Descriptions for any asset in the given assetIDs.
/// </summary>
[WebGet]
public IQueryable<Description> FindDescriptionForAssets(int[] assetIDs);
  1. I'm trying to create a custom service operation on a ADO.Net Data Service that takes an array of integers as a parameter. My understanding is that ADO.Net Data Services can't accept an array (or List or other enumerable) as a parameter. Is this true? Is there any way around it?

  2. It looks using arrays like this may be achievable by using the .Net RIA Services's DomainService. However, I haven't been able to find any examples demonstrating it. Can anyone confirm this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦一生花开无言 2024-08-15 01:29:05

RIA 服务支持传递整数数组。刚刚使用此服务调用对其进行了测试。

[ServiceOperation]
public string SayHello(int[] input)
{
    StringBuilder strings = new StringBuilder();

    foreach (var i in input)
    {
        strings.AppendFormat("Hello {0}!", i);
    }

    return strings.ToString();
}

不确定 ADO.Net 数据服务。由于 RESTful 接口,可能会出现问题。

RIA Services supports passing an array of integers. Just tested it out using this service call.

[ServiceOperation]
public string SayHello(int[] input)
{
    StringBuilder strings = new StringBuilder();

    foreach (var i in input)
    {
        strings.AppendFormat("Hello {0}!", i);
    }

    return strings.ToString();
}

Not sure on the ADO.Net Data Service. Might be an issue because of the RESTful interface.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文