Ria服务:同步DomainDataSource.SubmitChanges()

发布于 2024-09-08 02:22:53 字数 346 浏览 4 评论 0原文

我正在尝试将图像(字节数组)从客户端上传到数据库 - 这就像一个魅力。

问题是,我想向用户显示此操作的进度,但 DomainDataSource 对象不提供任何类型的进度事件。

如果我为每个实体调用 SubmitChanges,它会以某种方式开始重叠并且事情变得非常混乱,因此以下内容不起作用。

foreach(T entity in entities)
{
    myDomainDataSource.DataView.Add(entity);
    myDomainDataSource.SubmitChanges();
}

有人知道如何向用户显示这些图像的上传进度吗?

I'm trying to upload images (byte arrays) from the client to a database - this works like a charm.

The thing is, I'd like to show the progress of this operation to the user, but the DomainDataSource object doesn't provide any sort of progress-event.

If I call SubmitChanges for each entity it somehow starts to overlap and things get pretty messy, so the following doesn't work.

foreach(T entity in entities)
{
    myDomainDataSource.DataView.Add(entity);
    myDomainDataSource.SubmitChanges();
}

Anyone got an idea how to show the user the upload progress of those images?

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

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

发布评论

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

评论(1

凤舞天涯 2024-09-15 02:22:53

您需要分块上传图像......无论如何,您经常需要这样做,因为单个图像可能会运行最大请求大小的请求限制。

使用分块上传方法后,您可以根据已上传的图像量显示进度。

我在 TechEd Australia 上演示了这一点……虽然那是在 2007 年,而且代码很旧,但它应该基本上可以工作,或者可以作为一个起点。该示例演示了如何使用 Silverlight 增强 ajax 来执行多文件上传。请参阅http://www.nikhilk.net/Entry.aspx?id=169 样品的描述。也许这有帮助...

You'll need to upload your images in chunks... which you often need to do anyway, as a single image may run the request limit for the maximum request size.

Once you use a chunked uploading approach, then you can show progress based on how much of the image has been uploaded.

I demonstrated this at TechEd Australia... while this was in 2007, and the code is old, it should largely work, or serve as a starting point. The sample demonstrated how you can use Silverlight to augment ajax to do a multi-file upload. See http://www.nikhilk.net/Entry.aspx?id=169 for a description of the samples. Maybe it helps...

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