ODataController 和流示例

发布于 2025-01-14 08:58:44 字数 532 浏览 2 评论 0原文

我有以下要求。我有一个 odata 合同,如下:

public class videoStreamResponse
{
    public string Id { get; set; }
    public Action<Stream> VideoData { get; set; }
}

List<videoStreamResponse> exportVideo(string[] ids);

我的 odata 服务正在公开 videoStreamResponse 列表。将有 odata 操作返回视频流响应列表。

在服务实现中,我们调用另一个流式传输数据的服务。我们希望将其返回给调用者,而不必反序列化到内存中。相反,我需要将内容从后端视频服务直接流式传输到调用者,然后我需要写入 VideoData,它是返回流的委托。

中间层服务不应反序列化和序列化,因为这会增加内存。

是否有任何标准模式或方法可以使用 dotnet core 和 asp.net mvc odata 框架来执行此操作。

谢谢

I have the following requirement. I have a odata contract as follows:

public class videoStreamResponse
{
    public string Id { get; set; }
    public Action<Stream> VideoData { get; set; }
}

List<videoStreamResponse> exportVideo(string[] ids);

My odata service is exposing a list of videoStreamResponse . There will be odata action that returns the list of video stream response.

In the service implementation we call into another service that streams the data. We want to return this to the caller without having to deserialize into memory. Instead I need to stream the contents from the backend video service to the caller directly where by I need to write to the VideoData which is a delegate that returns a stream.

The middle tier service should not deserialize and serialize since that would increase the memory.

Is there any standard patterns or approach to do this with dotnet core and asp.net mvc odata framework.

Thanks

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文