简体   繁体   English

什么是对文件列表进行多功能检查的最佳方法?

[英]What would be best approach to do multiple functional checking on List of Files?

I have list of files ,where each file should undergo some group functional validations (10 methods) and return the status (Success/Failure)of the each validation. 我有文件列表,每个文件都应经过一些组功能验证(10种方法),并返回每个验证的状态(成功/失败)。 Mean while I need to notify the client the status of each file. 意思是我需要通知客户端每个文件的状态。 This application is a web application. 此应用程序是一个Web应用程序。 I think for the above scenario we can loop the list of files and process each functional validation throw the status to client. 我认为对于上述情况,我们可以循环处理文件列表并处理每个功能验证,并将状态提交给客户端。 If the list of files are increased more then this process could slow down the performance. 如果文件列表增加更多,则此过程可能会降低性能。 Can we do using TPL ? 我们可以使用TPL吗? Can any one suggest me with best solution ? 有人可以建议我最好的解决方案吗? Any helpful link if possble. 可能的任何有用链接。

One way to do it would be to use ConcurrentQueue and one or more dedicated threads to share the work. 一种方法是使用ConcurrentQueue和一个或多个专用线程来共享工作。 Another way would be to use Tasks, for which you would probably do a fairly similar thing, create a ConcurrentQueue of Tasks and give each Task a ContinueWith that will fetch another task from the queue and start it. 另一种方式是使用任务,您可能会做类似的事情,创建任务的ConcurrentQueue并为每个任务提供一个ContinueWith ,它将从队列中提取另一个任务并启动它。 If the producer is slower to produce Tasks than they are completed then at some point there will be no tasks running, anymore, though. 如果生产者生产任务的速度比完成任务的速度慢,那么在某些时候,将不再有任务在运行。 Generally for this scenario, I'd consider a thread to be the better choice (although worker threads in asp.net applications can cause trouble with IIS shutting them down randomly). 通常,对于这种情况,我认为线程是更好的选择(尽管asp.net应用程序中的辅助线程可能会导致IIS随机关闭它们的麻烦)。

For sending notifications to the client I'd recommend SignalR . 为了向客户端发送通知,我建议使用SignalR

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Silverlight中创建“联系人列表”的最佳方法是什么? - What is the best approach to creating a “list of contacts” in Silverlight? Windows Store App的登录屏幕-最好的方法是什么? - Login Screen for Windows Store App - What would be the best approach? 为多个控件分配可见性的最佳方法是什么 - What is the best approach to assign the visibility for multiple controls 一次执行存储过程将多个文件上传到数据库的最佳方法是什么 - What will be the best approach for uploading multiple files to database with single execution of stored procedure 检查字符串是否包含XML标记的最佳方法是什么? - What would be the best way of checking whether a string contains XML tags? .NET列出最佳方法 - .NET List best approach 等待多个独立任务的最佳方法/实践是什么? - What is the best approach/practice for awaiting multiple independent tasks? 在文本字段上进行关键字搜索的最佳方法是什么? - What's The Best Approach To Do Keyword Searching On A Text Field? 如何确保我的类的Initialize方法仅被调用一次,最好的方法是什么? - How to ensure that my class Initialize method is called only once, what would be the best approach? 与Thread.Sleep相比,在C#中暂停线程可获得更准确的时间-最佳方法是什么? - Pausing the thread in C# for more accurate time than Thread.Sleep - what would be the best approach?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM