选择WF CodeActivity和AsyncCodeActivity为DB操作之间 [英] Choosing Between WF CodeActivity and AsyncCodeActivity for DB Operations
问题描述
我还是相当新的WF所以用忍耐一下,如果我没有得到这个措辞正确的第一次。 ;)
I'm still fairly new to WF so bear with me if I don't get this worded correctly the first time. ;)
如果你正在做的选择对一个完善的标准化数据库,采用主键,返回单记录,在一个相当低的环境容量(几百每请求天),它真正有所作为是否使用 CodeActivity
VS AsyncCodeActivity
?
If you're doing selects against a well-normalized database, using primary keys, returning single records, in a fairly low volume environment (a few hundred requests per day), does it really make a difference whether you use CodeActivity
vs AsyncCodeActivity
?
虽然我有一些额外的研究上做主持和执行,这将是可能的,但不是可能的,因为在或接近同一时间收到多个请求。我不知道是否会改变答案还是不行。
While I've got some additional research to do on hosting and execution, it will be possible, but not probable, for multiple requests to be received at or near the same time. I'm not sure if that will change the answer or not.
谢谢!
推荐答案
微软使用的非异步他们ExecuteSqlQuery活动: HTTP://wf.codeplex。 COM /发行/查看/ 43585
Microsoft used non async in their ExecuteSqlQuery activity: http://wf.codeplex.com/releases/view/43585
异步活动:
:这是一个必须未持有工作流程调度执行异步工作的自定义活动有用螺纹以及阻断可能能够并行运行的活动。
Async Activities: "This is useful for custom activities that must perform asynchronous work without holding the workflow scheduler thread and blocking any activities that may be able to run in parallel."
作为要异步结果,AsyncCodeActivity可能在执行期间诱导空闲点,由于的异步工作挥发性质,一个AsyncCodeActivity总是创建没有坚持块为活动的执行的持续时间。这防止工作流运行时从在异步工作的中间持续工作流实例,并还防止工作流实例从卸而。异步代码执行
"As a result of going asynchronous, an AsyncCodeActivity may induce an idle point during execution. Due to the volatile nature of asynchronous work, an AsyncCodeActivity always creates a no persist block for the duration of the activity’s execution. This prevents the workflow runtime from persisting the workflow instance in the middle of the asynchronous work, and also prevents the workflow instance from unloading while the asynchronous code is executing."
来源:的 http://msdn.microsoft.com/en-us/library/ee358731.aspx
编辑:我注意到,仅指出出使用异步的缺点,我会考虑罗恩和蒂姆的反应做出更好的决策。
I noticed that only pointed out the disadvantages of using async I would consider the responses of Ron and Tim to make a better decision
这篇关于选择WF CodeActivity和AsyncCodeActivity为DB操作之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!