我如何揭开序幕的实体存储过程EF6异步,而不是等待返回? [英] How do I kick off an entity stored procedure in EF6 async and not wait for a return?

查看:203
本文介绍了我如何揭开序幕的实体存储过程EF6异步,而不是等待返回?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想只是踢呼叫转移到SQL Server和不等待回报。我有,我想异步调用这种方式在实体框架6.0.0-RC1存储过程导入实体功能。这可能吗?什么是语法?

 实体功能:RecalculateBudgetNumbers(INT ID)


解决方案

开始一个新的工作创建一个新的数据上下文并调用该函数。只是不要等到/静候任务。让它本身运行完毕。

确认记录错误。不要吞咽异常,因为他们可能是错误你想知道的。

在一个ASP.NET的设置,要知道,工作进程可以在任何时候都回收,所以你的工作背景可以突然消失(或取消)。

I'd like to just punt a call over to the SQL Server and not wait for a return. I have an imported Entity Function from a Stored Procedure that I'd like to call asynchronously this way in Entity Framework 6.0.0-rc1. Is this possible? What's the syntax?

Entity Function: RecalculateBudgetNumbers(int id)

解决方案

Start a new Task that creates a fresh data context and invokes that function. Just don't wait/await that task. Let it run by itself to completion.

Make sure to log errors. Don't swallow exceptions because they might be bugs you want to know about.

In an ASP.NET setting, be aware that the worker process can recycle at any time at all, so your background work can suddenly disappear (or be cancelled).

这篇关于我如何揭开序幕的实体存储过程EF6异步,而不是等待返回?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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