异步Storec PROC无需等待完成 [英] Asynchronous Storec Proc without waiting for completion

查看:107
本文介绍了异步Storec PROC无需等待完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有擦伤数据到原始表的客户机应用程序。该客户端应用程序,以实际解析原始数据转换成表的存储过程的异步调用。这个处理是由一个存储过程处理。该存储过程可能需要长达一个半小时运行。我们希望客户端应用程序调用存储过程,退出并完全停止运行。只要我们杀调用存储过程存储过程执行退出客户端应用程序。

什么是达致这最好的方法是什么?我不想在服务器上运行的作业。我想客户端应用程序来触发此处理。数据库触发器(我的第一个想法)没有解决的问题可能是因为它没有考虑到插入完成,直到存储过程的触发器呼吁就完成了。

下面是异步方法。我使用LINQ。我能以某种方式修改这个?还是我需要一个新的设计完全?

 部分类MetaDataContext
{    委托INT Process_CompleteCycle2Delegate(INT frequencyID,诠释cycleID?);    公共无效Process_CompleteCycle2Async(INT?frequencyID,诠释?cycleID)
    {
        Process_CompleteCycle2Delegate completeCycleDelegate =新Process_CompleteCycle2Delegate(this.Process_CompleteCycle2);
        IAsyncResult的异步= completeCycleDelegate.BeginInvoke(frequencyID,cycleID,NULL,NULL);}


解决方案

请参见异步过程执行一个可靠和事务consitent方式。

I have a client application that scrapes data into a raw table. This client application makes an asynchronous call to a stored procedure that actually parses the raw data into tables. This processing is handled by a stored procedure. That stored procedure can take up to a half hour to run. We want the client application calling the stored proc to exit and completely stop running. As soon as we kill the client application that calls the stored proc the stored procedure quits executing.

What is the best way to acheive this? I do not want to run a job on the server. I want the client application to trigger this processing. A database trigger (my first idea) didn't solve the problem either because it doesn't consider the insert complete until the stored procedure the trigger is calling is complete.

Here is the Async method. I'm using LINQ. Can I somehow modify this? Or do I need a new design altogether?

partial class MetaDataContext
{

    delegate int Process_CompleteCycle2Delegate(int? frequencyID, int? cycleID);

    public void Process_CompleteCycle2Async(int? frequencyID, int? cycleID)
    {
        Process_CompleteCycle2Delegate completeCycleDelegate = new Process_CompleteCycle2Delegate(this.Process_CompleteCycle2);
        IAsyncResult async = completeCycleDelegate.BeginInvoke(frequencyID, cycleID, null, null);

}

解决方案

See Asynchronous procedure execution for a reliable and transactionally consitent way.

这篇关于异步Storec PROC无需等待完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆