是否.NET 4.5的异步功能的工作与MySQL等数据库吗? [英] Does .NET 4.5's async feature work with MySql and other databases too?

查看:427
本文介绍了是否.NET 4.5的异步功能的工作与MySQL等数据库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的理解是.NET 4.5自带了一堆功能,使异步数据库操作更容易实现。 MSDN说,如果在连接​​字符串没有被设置为异步工作都不ADO.NET的异步方法将在异步方式工作。因此SqlConnectionStringBuilder自带了一个叫做AsynchronousProcessing属性。

I understand that .NET 4.5 comes with a bunch of features to make asynchronous database operations easier to implement. MSDN says that if the connection string is not set to work asynchronously none of the async methods of ADO.NET will work in an asynchronous way. Therefore SqlConnectionStringBuilder comes with a property called AsynchronousProcessing.

我想知道如果这些异步功能将与其他数据库服务器(如MySQL的),以及工作?我应该怎么做才能让aync工作,不是由.NET认可无SQL数据库? (例如RavenDB)?

I am wondering if these async features will work with other database servers (e.g. mysql) as well? What should I do to make aync work with a no-SQL database that is not recognized by .NET? (e.g. RavenDB)?

推荐答案

所有驱​​动异步方法DbDataReader定义,如: DbDataReader.ReadAsync 。它是由特定的驱动程序来覆盖这些方法与具体实现以利用每个数据库的异步特性优势,并使用如。天然异步操作,而不是裹在一个线程同步运转。

The asynchronous methods for all drivers are defined in DbDataReader, eg DbDataReader.ReadAsync. It is up to the specific drivers to override these methods with specific implementations to take advantage of the asynchronous characteristics of each database and use eg. a naturally asynchronous operation instead of a synchronous operation wrapped in a thread.

这是说,MySQL的连接器/净6.8增加了对的异步操作的实体框架6 不过了MySqlDataReader类不提供一个 ReadAsync 方法。这是因为连接器​​使用的老建筑(pre-2.0),实现IDataReader的接口,而不是从引进在通用DbDataReader类派生.NET 2.0。

That said, MySQL Connector/Net 6.8 adds support for asynchronous operations in Entity Framework 6 but the MySqlDataReader class does NOT provide a ReadAsync method. This is because Connector uses an old architecture (pre-2.0), implementing the IDataReader interface instead of deriving from the generic DbDataReader class introduced in .NET 2.0.

这篇关于是否.NET 4.5的异步功能的工作与MySQL等数据库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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