问题描述
我知道 Acumatica 不推荐这种方式,但除了使用存储过程之外,我们别无选择.我创建了一个新的处理屏幕来执行存储过程,但面临超时异常.
I know this is not recommended way by Acumatica, but we don't have other option than to use stored procedure. I have created a new processing screen to execute stored procedure but am facing time out exception.
我的代码示例如下:
using (new PXConnectionScope())
{
using (PXTransactionScope ts = new PXTransactionScope())
{
PXDatabase.Execute("MYSTOREDPROCEDURE", pars.ToArray());
ts.Complete();
}
}
推荐答案
尝试在 PXLongOperation
上下文中执行长时间运行的代码.我假设这些建立与定期 ping 的连接以避免在等待数据到达时超时.
Try executing long running code in PXLongOperation
context. I assume these establishes a connection with periodic ping to avoid time-out while waiting for data to arrive.
PXLongOperation.StartOperation(Base, delegate()
{
// Code executed in long operation context
});
如果您的代码是从处理委托的上下文中执行的,我认为它应该已经包含在一个长操作中.否则,应在动作事件处理程序中使用长操作.
If your code is executed from the context of a processing delegate I think it should be already wrapped in a long operation though. Otherwise long operation should be used inside an action event handler.
最后的办法是在 web.config
文件中增加超时.存储过程的使用主要是 SAAS 托管和获得 Acumatica ISV 认证的一个问题.它可能没有官方支持,但我怀疑它会消失.
A last recourse would be to increase time-out in the web.config
file.Use of stored procedure is a concern mainly for SAAS hosting and obtaining an Acumatica ISV Certification. There's likely no official support for it but I doubt it's gonna go away.
这篇关于如何执行存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!