开发者

Ria Services: Synchronous DomainDataSource.SubmitChanges()

开发者 https://www.devze.com 2023-01-05 13:51 出处:网络
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 DomainDataSourc

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?


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消